2019-04-28 18:59:42 +00:00
|
|
|
from swapper import swappable_setting
|
2018-05-30 05:18:33 +00:00
|
|
|
|
2019-04-28 18:59:42 +00:00
|
|
|
from .base.models import AbstractNotification, notify_handler # noqa
|
2019-03-26 20:59:09 +00:00
|
|
|
|
2015-04-28 12:10:49 +00:00
|
|
|
|
2019-04-28 18:59:42 +00:00
|
|
|
class Notification(AbstractNotification):
|
2012-07-22 13:14:44 +00:00
|
|
|
|
2019-04-28 18:59:42 +00:00
|
|
|
class Meta(AbstractNotification.Meta):
|
|
|
|
|
abstract = False
|
|
|
|
|
swappable = swappable_setting('notifications', 'Notification')
|
2023-05-07 20:41:35 +00:00
|
|
|
|
2019-03-29 12:11:06 +00:00
|
|
|
def naturalday(self):
|
2019-03-26 20:59:09 +00:00
|
|
|
"""
|
|
|
|
|
Shortcut for the ``humanize``.
|
2019-03-26 21:01:21 +00:00
|
|
|
Take a parameter humanize_type. This parameter control the which humanize method use.
|
|
|
|
|
Return ``today``, ``yesterday`` ,``now``, ``2 seconds ago``etc.
|
2019-03-26 20:59:09 +00:00
|
|
|
"""
|
2019-03-29 12:11:06 +00:00
|
|
|
from django.contrib.humanize.templatetags.humanize import naturalday
|
|
|
|
|
return naturalday(self.timestamp)
|
2019-03-26 20:59:09 +00:00
|
|
|
|
2019-03-29 12:11:06 +00:00
|
|
|
def naturaltime(self):
|
|
|
|
|
from django.contrib.humanize.templatetags.humanize import naturaltime
|
2023-05-07 20:41:35 +00:00
|
|
|
return naturaltime(self.timestamp)
|