From 9aaa7a2b590a0793baa547c8230c642c129e5653 Mon Sep 17 00:00:00 2001 From: Gael Le Mignot Date: Tue, 22 May 2018 11:02:54 +0200 Subject: [PATCH] Allowing annals with empty iej --- teleforma/templates/teleforma/annals.html | 2 +- teleforma/views/crfpa.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/teleforma/templates/teleforma/annals.html b/teleforma/templates/teleforma/annals.html index bd22be7e..e1402261 100644 --- a/teleforma/templates/teleforma/annals.html +++ b/teleforma/templates/teleforma/annals.html @@ -57,7 +57,7 @@
{% if not student %} -

{{ iej }}

+

{% if iej %}{{ iej }}{% else %}National{% endif %}

{% endif %}
diff --git a/teleforma/views/crfpa.py b/teleforma/views/crfpa.py index 40e4359d..abf247fd 100644 --- a/teleforma/views/crfpa.py +++ b/teleforma/views/crfpa.py @@ -37,6 +37,7 @@ from registration.views import * from extra_views import CreateWithInlinesView, UpdateWithInlinesView, InlineFormSet from django.utils.translation import ugettext_lazy as _ from django.views.decorators.csrf import csrf_exempt +from django.db.models import Q def get_course_code(obj): @@ -349,7 +350,7 @@ class AnnalsView(ListView): docs = Document.objects.filter(is_annal=True).order_by('-annal_year') elif students: self.student = students[0] - docs = Document.objects.filter(is_annal=True, iej=self.student.iej).order_by('-annal_year') + docs = Document.objects.filter(is_annal=True).filter(Q(iej=self.student.iej) | Q(iej=None)).order_by('-annal_year') if iej: docs = docs.filter(iej=iej) if course: -- 2.39.5