From 0427aa836e372751e6e226c3ab6b64c6eaeeefe7 Mon Sep 17 00:00:00 2001 From: Ross Date: Tue, 31 Aug 2021 22:49:41 +0100 Subject: [PATCH] . --- generic/models.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/generic/models.py b/generic/models.py index 7d97a82f..2ab8e648 100644 --- a/generic/models.py +++ b/generic/models.py @@ -101,6 +101,16 @@ class ExamBase(models.Model): def get_question_index(self, question): return list(self.exam_questions.all()).index(question) + def get_authors(self): + """Returns a comma seperated text list of authors""" + authors = ", ".join([i.username for i in self.author.all()]) + return authors + + def get_author_objects(self): + """Returns a comma seperated text list of authors""" + authors = [i for i in self.author.all()] + return authors + class NoteType(models.Model): note_type = models.CharField(max_length=200)