예제 #1
0
파일: views.py 프로젝트: icsystems/SAPeM
def formOrderList(usr):
	import_str = 'from forms.models import Grupo_Formulario, Grupo, Formulario'
	exec import_str
	groups = Grupo.objects.filter(membros=usr)
	forms  = []
	formsOrder = ['Triagem', 'Consulta', 'Exames', 'Follow-up']
	for t in formsOrder:
		forms.extend(
			Grupo_Formulario.objects.filter(formulario__tipo__nome=t).filter(grupo__in = groups)\
				.values_list('formulario', flat=True).distinct()
			)
	form_list =[]
	for id in forms:
		form_list.append(Formulario.objects.get(pk=id))
	return form_list
예제 #2
0
 def _all_forms(self):
     forms = []
     unknown_forms = []
     for f in get_exports_by_form(self.domain):
         form = f['value']
         if form.get('app_deleted') and not form.get('submissions'):
             continue
         if 'app' in form:
             form['has_app'] = True
             forms.append(form)
         else:
             app_id = f['key'][1] or ''
             form['app'] = {'id': app_id}
             form['has_app'] = False
             form['show_xmlns'] = True
             unknown_forms.append(form)
     forms.extend(self._attach_unknown_suggestions(unknown_forms))
     return sorted(forms, key=self._sort_key_form)
def viewPastHostelLeaveForms(request):
    if (isStudent(request) or isSecretary(request)):
        forms = []
        try:
            forms.extend(HostelLeavingInformation.objects.filter(studid = request.session.get('uid')))
        except:
            pass
        if isStudent(request):
            return render_to_response('student/previousleave.html', {'list' : forms, 'msg': request.session.get('name')})
        else:
            return render_to_response('secretary/previousleave.html', {'list' : forms, 'msg': request.session.get('name')})
    elif isWarden(request):
        forms = []
        try:
            forms.extend(HostelLeavingInformation.objects.filter(hostel = request.session.get('hostel')))
        except:
            pass
        return render_to_response('warden/newLeaveApplication.html', {'list' : forms, 'msg': request.session.get('name')})
예제 #4
0
 def _all_forms(self):
     forms = []
     unknown_forms = []
     for f in get_exports_by_form(self.domain):
         form = f["value"]
         if form.get("app_deleted") and not form.get("submissions"):
             continue
         if "app" in form:
             form["has_app"] = True
             forms.append(form)
         else:
             app_id = f["key"][1] or ""
             form["app"] = {"id": app_id}
             form["has_app"] = False
             form["show_xmlns"] = True
             unknown_forms.append(form)
     forms.extend(self._attach_unknown_suggestions(unknown_forms))
     return sorted(forms, key=self._sorkey_form)
예제 #5
0
 def _all_forms(self):
     forms = []
     unknown_forms = []
     for f in get_exports_by_form(self.domain):
         form = f['value']
         if form.get('app_deleted') and not form.get('submissions'):
             continue
         if 'app' in form:
             form['has_app'] = True
             forms.append(form)
         else:
             app_id = f['key'][1] or ''
             form['app'] = {
                 'id': app_id
             }
             form['has_app'] = False
             form['show_xmlns'] = True
             unknown_forms.append(form)
     forms.extend(self._attach_unknown_suggestions(unknown_forms))
     return sorted(forms, key=self._sorkey_form)
예제 #6
0
파일: jinja.py 프로젝트: VadymRud/nedvizh
def merge_forms_with_formsets(form, formsets):
    formsets = formsets or []
    forms = [form]
    for formset in formsets:
        forms.extend(formset)
    return forms