models.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. from importlib import import_module
  2. import json
  3. from django.db import models
  4. from django.utils import timezone
  5. from django.utils.encoding import python_2_unicode_compatible
  6. from django.utils.translation import ugettext_lazy as _
  7. from jet.utils import LazyDateTimeEncoder
  8. @python_2_unicode_compatible
  9. class Bookmark(models.Model):
  10. url = models.URLField(verbose_name=_('URL'))
  11. title = models.CharField(verbose_name=_('title'), max_length=255)
  12. user = models.PositiveIntegerField(verbose_name=_('user'))
  13. date_add = models.DateTimeField(verbose_name=_('date created'), default=timezone.now)
  14. class Meta:
  15. verbose_name = _('bookmark')
  16. verbose_name_plural = _('bookmarks')
  17. ordering = ('date_add',)
  18. def __str__(self):
  19. return self.title
  20. @python_2_unicode_compatible
  21. class PinnedApplication(models.Model):
  22. app_label = models.CharField(verbose_name=_('application name'), max_length=255)
  23. user = models.PositiveIntegerField(verbose_name=_('user'))
  24. date_add = models.DateTimeField(verbose_name=_('date created'), default=timezone.now)
  25. class Meta:
  26. verbose_name = _('pinned application')
  27. verbose_name_plural = _('pinned applications')
  28. ordering = ('date_add',)
  29. def __str__(self):
  30. return self.app_label