@@ -88,7 +88,7 @@ class EventAdmin(admin.ModelAdmin):
list_display = (
"author",
"date",
- "snippet"
+ "body"
)
class AttachmentAdmin(admin.ModelAdmin):
@@ -16,15 +16,5 @@ class Event(models.Model):
body = models.TextField(blank=True)
- def author_text(self):
- if self.author is not None:
- return str(self.author)
-
- @property
- def snippet(self):
- body_snippet = textwrap.shorten(self.body, width=35, placeholder="...")
- # Define here rather than in __str__ so we can use it in the admin list_display
- return "{author} - {snippet}...".format(author=self.author_text, snippet=body_snippet)
def __str__(self):
- return self.snippet
+ return self.body
@@ -223,7 +223,7 @@
<!--History block-->
- <h4 class="mt-4">History</h4>
+ <h4 class="mt-4">Status history</h4>
{% if event_list %}
{% for event in event_list %}
@@ -57,7 +57,7 @@ class TicketDetailView(LoginRequiredMixin, UserCanReadTicketMixin, DetailView):
Event.objects.create(
author=request.user,
ticket=ticket,
- body="Ticket status was changed from "+str(old_status)+" to "+status
+ body="Ticket status was changed from "+Ticket.TICKET_STATUSES_NAMES.get(old_status)+" to "+Ticket.TICKET_STATUSES_NAMES.get(int(status))
else:
messages.error(request, f"Status change error.")