.
This commit is contained in:
@@ -35,6 +35,9 @@ class Entry(models.Model):
|
||||
self.questions = self.questions.replace("\r\n", "\n")
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
def get_current_format(self):
|
||||
return Formats.objects.filter(format=self.questions).first()
|
||||
|
||||
class Formats(models.Model):
|
||||
name = models.CharField(max_length=200)
|
||||
format = models.TextField(blank=True)
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@ from django.utils.html import format_html
|
||||
|
||||
class EntryTable(tables.Table):
|
||||
view = tables.LinkColumn(
|
||||
"oef:entry_detail", text="Edit", args=[A("pk")], orderable=False
|
||||
"oef:entry_detail", text="View", args=[A("pk")], orderable=False
|
||||
)
|
||||
edit = tables.LinkColumn(
|
||||
"oef:entry_update", text="View", args=[A("pk")], orderable=False
|
||||
"oef:entry_update", text="Edit", args=[A("pk")], orderable=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
|
||||
<p>Comments: {{ entry.comments }}</p>
|
||||
|
||||
Current format: {{ entry.get_current_format }}
|
||||
|
||||
<br/>
|
||||
|
||||
<button
|
||||
hx-get="{% url 'oef:entry_detail_formats' entry.pk %}"
|
||||
|
||||
Reference in New Issue
Block a user