add some tests and views

This commit is contained in:
Ross
2024-01-29 10:52:02 +00:00
parent 04dcb74e67
commit cfb90be686
11 changed files with 142 additions and 6 deletions
+20
View File
@@ -1523,3 +1523,23 @@ class ExamCollection(models.Model):
date = models.DateField(blank=True,null=True)
author = models.ManyToManyField(
settings.AUTH_USER_MODEL,
blank=True,
help_text="Author/Manager(s) of the exam collection",
)
def __str__(self):
return f"{self.name} [{self.date}]"
def get_author_objects(self):
"""Returns a comma seperated text list of authors"""
authors = [i for i in self.author.all()]
return authors
def get_authors(self):
"""Returns a comma seperated text list of authors"""
authors = ", ".join([i.username for i in self.author.all()])
if not authors:
return "None"
return authors