2023-08-01 16:47:47 +05:30
|
|
|
from django.db import models
|
2024-05-07 12:23:36 +05:30
|
|
|
from swapper import swappable_setting
|
|
|
|
|
|
2025-12-17 14:04:00 +05:30
|
|
|
from .base.models import AbstractNotification
|
2023-08-01 16:47:47 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
class Notification(AbstractNotification):
|
2024-03-10 19:37:46 +05:30
|
|
|
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)
|
2023-08-01 16:47:47 +05:30
|
|
|
|
|
|
|
|
class Meta(AbstractNotification.Meta):
|
|
|
|
|
abstract = False
|
2024-03-10 19:37:46 +05:30
|
|
|
swappable = swappable_setting("notifications", "Notification")
|
2025-12-17 14:04:00 +05:30
|
|
|
|
|
|
|
|
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)
|