diff --git a/oef/models.py b/oef/models.py index bc410659..e306961c 100644 --- a/oef/models.py +++ b/oef/models.py @@ -72,3 +72,10 @@ class Formats(models.Model): def get_entries(self): return Entry.objects.filter(questions__icontains=self.get_format(), inactive=False) + + def get_entries_and_if_exact(self): + entries = Entry.objects.filter(questions__icontains=self.get_format(), inactive=False) + + l = [(entry, entry.questions == self.get_format()) for entry in entries] + + return sorted(l, key=lambda x: (x[1], x[0].exam_code), reverse=False) diff --git a/oef/templates/oef/formats_update_form.html b/oef/templates/oef/formats_update_form.html index 75776828..73695ac2 100644 --- a/oef/templates/oef/formats_update_form.html +++ b/oef/templates/oef/formats_update_form.html @@ -13,7 +13,24 @@