32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
from django.db import models
|
|
from swapper import swappable_setting
|
|
|
|
from .base.models import AbstractNotification
|
|
|
|
|
|
class Notification(AbstractNotification):
|
|
verb_en = models.CharField(max_length=255, default="", null=True)
|
|
verb_ar = models.CharField(max_length=255, default="", null=True)
|
|
verb_de = models.CharField(max_length=255, default="", null=True)
|
|
verb_es = models.CharField(max_length=255, default="", null=True)
|
|
verb_fr = models.CharField(max_length=255, default="", null=True)
|
|
|
|
class Meta(AbstractNotification.Meta):
|
|
abstract = False
|
|
swappable = swappable_setting("notifications", "Notification")
|
|
|
|
def naturalday(self):
|
|
"""
|
|
Shortcut for the ``humanize``.
|
|
Take a parameter humanize_type. This parameter control the which humanize method use.
|
|
Return ``today``, ``yesterday`` ,``now``, ``2 seconds ago``etc.
|
|
"""
|
|
from django.contrib.humanize.templatetags.humanize import naturalday
|
|
|
|
return naturalday(self.timestamp)
|
|
|
|
def naturaltime(self):
|
|
from django.contrib.humanize.templatetags.humanize import naturaltime
|
|
|
|
return naturaltime(self.timestamp)
|