models.py 1.2 KB

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