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
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')})
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)
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)
def merge_forms_with_formsets(form, formsets): formsets = formsets or [] forms = [form] for formset in formsets: forms.extend(formset) return forms