Skip to content

Commit

Permalink
Made the F.A.Q admin list page a bit easier to read. Truncated questi…
Browse files Browse the repository at this point in the history
…ons and answers and swapped the order to be question first
  • Loading branch information
PasiVuohijoki committed Aug 25, 2023
1 parent 86b3e0e commit 35b979b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plotsearch/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class FavouriteAdmin(FieldPermissionsAdminMixin, admin.ModelAdmin):

class FAQAdmin(admin.ModelAdmin):
list_display = (
"answer",
"question",
"question_truncate",
"answer_truncate",
)


Expand Down
8 changes: 8 additions & 0 deletions plotsearch/models/plot_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,14 @@ class FAQ(models.Model):
question = models.TextField(unique=True)
answer = models.TextField()

@property
def question_truncate(self):
return self.question if len(self.question) < 50 else (self.question[:50] + "..")

@property
def answer_truncate(self):
return self.answer if len(self.answer) < 50 else (self.answer[:50] + "..")


auditlog.register(PlotSearch)
auditlog.register(InformationCheck)

0 comments on commit 35b979b

Please sign in to comment.