start taking more advantage of class based views
This commit is contained in:
+15
-2
@@ -5,7 +5,7 @@ import pathlib
|
||||
from typing import Tuple
|
||||
|
||||
from django.http import Http404, HttpRequest
|
||||
from generic.mixins import AuthorMixin
|
||||
from generic.mixins import AuthorMixin, QuestionMixin
|
||||
from rad.settings import REMOTE_URL
|
||||
from django.db.models.fields.files import ImageField
|
||||
from django.db.models.fields.related import ForeignKey
|
||||
@@ -273,7 +273,7 @@ class Structure(SynMixin, models.Model):
|
||||
|
||||
|
||||
@reversion.register
|
||||
class Case(models.Model, AuthorMixin):
|
||||
class Case(models.Model, AuthorMixin, QuestionMixin):
|
||||
# class SubspecialtyChoices(models.TextChoices):
|
||||
# BREAST = "BR", _("Breast")
|
||||
# CARDIAC = "CA", _("Cardiac")
|
||||
@@ -364,6 +364,9 @@ class Case(models.Model, AuthorMixin):
|
||||
blank=True,
|
||||
)
|
||||
|
||||
def get_app_name(self):
|
||||
return "atlas"
|
||||
|
||||
# question_file = models.FileField(upload_to=question_file_directory_path, blank=True, null=True)
|
||||
|
||||
def get_absolute_url(self):
|
||||
@@ -373,6 +376,10 @@ class Case(models.Model, AuthorMixin):
|
||||
# return f"{self.pk}: {self.title}"
|
||||
return format_html("<a href='{}'>{}</a>", self.get_absolute_url(), str(self))
|
||||
|
||||
#def get_base_template(self):
|
||||
|
||||
#def get_edit_template_links(self):
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.pk}: {self.title}"
|
||||
|
||||
@@ -773,6 +780,12 @@ class CaseCollection(ExamOrCollectionGenericBase):
|
||||
default=VIEWER_MODE_CHOICES.BUILT_IN,
|
||||
)
|
||||
|
||||
def get_app_name(self):
|
||||
return "atlas"
|
||||
|
||||
def get_link_headers(self):
|
||||
return f"{self.get_app_name()}/collection_headers.html"
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse("atlas:collection_detail", kwargs={"pk": self.pk})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user