This commit is contained in:
Ross
2021-02-25 18:02:02 +00:00
parent 67163e85ee
commit f5b61f4488
9 changed files with 68 additions and 7 deletions
+18
View File
@@ -0,0 +1,18 @@
# Generated by Django 3.1.3 on 2021-02-25 17:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('longs', '0025_auto_20210217_2218'),
]
operations = [
migrations.AddField(
model_name='long',
name='description',
field=models.TextField(blank=True, help_text='Description of the case, for admin organisation, will not be visible when taking'),
),
]
+6 -1
View File
@@ -58,6 +58,11 @@ def findMiddle(input_list):
class Long(models.Model):
# author = models.ForeignKey('auth.User', on_delete=models.CASCADE)
# image = models.ImageField()
description = models.TextField(
blank=True,
help_text="Description of the case, for admin organisation, will not be visible when taking",
)
history = models.TextField(null=True, blank=True)
feedback = models.TextField(null=True, blank=True)
@@ -121,7 +126,7 @@ class Long(models.Model):
def __str__(self):
examinations = [series.get_examination() for series in self.series.all()]
return "{} : {}".format(self.history, ", ".join(examinations))
return "{} : {}".format(self.description, ", ".join(examinations))
def GetExams(self):
e = self.exams.all().values_list("name", flat=True)
+1 -1
View File
@@ -70,7 +70,7 @@ class LongTable(tables.Table):
class Meta:
model = Long
template_name = "django_tables2/bootstrap4.html"
fields = ("history", "created_date", "author")
fields = ("description", "history", "created_date", "author")
sequence = ("view", "series", "exams")
class PopupLinkColumn(tables.Column):
@@ -2,6 +2,7 @@
<div class="date">
{{ question.created_date }}
</div>
<p class="pre-whitespace"><b>Description:</b> {{ question.description }}</p>
<p class="pre-whitespace"><b>History:</b> {{ question.history }}</p>
+2 -2
View File
@@ -586,14 +586,14 @@ def get_region_id(request):
return HttpResponse("/")
class LongView(SingleTableMixin, FilterView):
class LongView(LoginRequiredMixin, SingleTableMixin, FilterView):
model = Long
table_class = LongTable
template_name = "longs/view.html"
filterset_class = LongFilter
class LongSeriesView(SingleTableMixin, FilterView):
class LongSeriesView(LoginRequiredMixin, SingleTableMixin, FilterView):
model = LongSeries
table_class = LongSeriesTable
template_name = "longs/view.html"