From 671659a1fb1588aa0d6929871e34d00fea2aa34e Mon Sep 17 00:00:00 2001 From: Dominik George <dominik.george@teckids.org> Date: Mon, 16 Nov 2020 13:51:17 +0100 Subject: [PATCH] Use TimeStampedModel for Activity and Notification --- aleksis/core/models.py | 5 +++-- aleksis/core/templates/core/index.html | 4 ++-- aleksis/core/templates/templated_email/notification.email | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/aleksis/core/models.py b/aleksis/core/models.py index 4c9c28ea6..358782690 100644 --- a/aleksis/core/models.py +++ b/aleksis/core/models.py @@ -21,6 +21,7 @@ from django.utils.translation import gettext_lazy as _ import jsonstore from cache_memoize import cache_memoize from dynamic_preferences.models import PerInstancePreferenceModel +from model_utils.models import TimeStampedModel from phonenumber_field.modelfields import PhoneNumberField from polymorphic.models import PolymorphicModel @@ -440,7 +441,7 @@ class PersonGroupThrough(ExtensibleModel): setattr(self, field_name, field_instance) -class Activity(ExtensibleModel): +class Activity(ExtensibleModel, TimeStampedModel): """Activity of a user to trace some actions done in AlekSIS in displayable form.""" user = models.ForeignKey( @@ -460,7 +461,7 @@ class Activity(ExtensibleModel): verbose_name_plural = _("Activities") -class Notification(ExtensibleModel): +class Notification(ExtensibleModel, TimeStampedModel): """Notification to submit to a user.""" sender = models.CharField(max_length=100, verbose_name=_("Sender")) diff --git a/aleksis/core/templates/core/index.html b/aleksis/core/templates/core/index.html index 683adca90..bcf0bf1b4 100644 --- a/aleksis/core/templates/core/index.html +++ b/aleksis/core/templates/core/index.html @@ -48,7 +48,7 @@ <span class="badge new primary-color">{{ activity.app }}</span> <span class="title">{{ activity.title }}</span> <p> - <i class="material-icons left">access_time</i> {{ activity.created_at }} + <i class="material-icons left">access_time</i> {{ activity.created }} </p> <p> {{ activity.description }} @@ -71,7 +71,7 @@ <span class="badge new primary-color">{{ notification.app }}</span> <span class="title">{{ notification.title }}</span> <p> - <i class="material-icons left">access_time</i> {{ notification.created_at }} + <i class="material-icons left">access_time</i> {{ notification.created }} </p> <p> {{ notification.description }} diff --git a/aleksis/core/templates/templated_email/notification.email b/aleksis/core/templates/templated_email/notification.email index 8e61fd0df..0e5d9bdee 100644 --- a/aleksis/core/templates/templated_email/notification.email +++ b/aleksis/core/templates/templated_email/notification.email @@ -15,7 +15,7 @@ {% trans "More information" %} → {{ notification.link }} {% endif %} - {% blocktrans with trans_sender=notification.sender trans_created_at=notification.created_at %} + {% blocktrans with trans_sender=notification.sender trans_created_at=notification.created %} Sent by {{ trans_sender }} at {{ trans_created_at }} {% endblocktrans %} @@ -37,7 +37,7 @@ </blockquote> <p> - {% blocktrans with trans_sender=notification.sender trans_created_at=notification.created_at %} + {% blocktrans with trans_sender=notification.sender trans_created_at=notification.created %} Sent by {{ trans_sender }} at {{ trans_created_at }} {% endblocktrans %} </p> -- GitLab