From e69d1a6b9a0ae5641b06e8d4981e48f1579a38c4 Mon Sep 17 00:00:00 2001 From: Ross Date: Wed, 9 Oct 2024 23:12:56 +0100 Subject: [PATCH] . --- oef/models.py | 4 ++++ oef/templates/oef/formats_update_form.html | 6 ++++++ oef/templates/oef/questions.html | 16 ++++++++++++---- oef/views.py | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/oef/models.py b/oef/models.py index d5512ba6..fb73f4be 100644 --- a/oef/models.py +++ b/oef/models.py @@ -49,6 +49,7 @@ class Formats(models.Model): self.format = self.format.replace("\r\n", "\n") return super().clean() + def save(self, *args, **kwargs): self.format = self.format.replace("\r\n", "\n") return super().save(*args, **kwargs) @@ -62,6 +63,9 @@ class Formats(models.Model): formats.reverse() return "\n".join(formats) + def get_entries(self): + return Entry.objects.filter(questions__icontains=self.get_format()) + class Specialty(models.Model): name = models.CharField(max_length=200) diff --git a/oef/templates/oef/formats_update_form.html b/oef/templates/oef/formats_update_form.html index 2dcc4a17..75d08700 100644 --- a/oef/templates/oef/formats_update_form.html +++ b/oef/templates/oef/formats_update_form.html @@ -5,4 +5,10 @@ {{ form }} + +

Entries

+