Create Author mixin
This commit is contained in:
+2
-11
@@ -4,6 +4,7 @@ import pathlib
|
||||
from typing import Tuple
|
||||
|
||||
from django.http import Http404, HttpRequest
|
||||
from generic.mixins import AuthorMixin
|
||||
from rad.settings import REMOTE_URL
|
||||
from django.db.models.fields.files import ImageField
|
||||
from django.db.models.fields.related import ForeignKey
|
||||
@@ -273,7 +274,7 @@ class Structure(SynMixin, models.Model):
|
||||
|
||||
|
||||
@reversion.register
|
||||
class Case(models.Model):
|
||||
class Case(models.Model, AuthorMixin):
|
||||
# class SubspecialtyChoices(models.TextChoices):
|
||||
# BREAST = "BR", _("Breast")
|
||||
# CARDIAC = "CA", _("Cardiac")
|
||||
@@ -369,16 +370,6 @@ class Case(models.Model):
|
||||
def get_absolute_url(self):
|
||||
return reverse("atlas:case_detail", kwargs={"pk": self.pk})
|
||||
|
||||
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
|
||||
|
||||
def get_link(self):
|
||||
# return f"{self.pk}: {self.title}"
|
||||
return format_html("<a href='{}'>{}</a>", self.get_absolute_url(), str(self))
|
||||
|
||||
Reference in New Issue
Block a user