image_gallery.models: 15 total statements, 100.0% covered

Generated: Wed 2013-03-13 13:05 CET

Source file: /home/tobi/Projects/cmsplugin-image-gallery/src/image_gallery/models.py

Stats: 8 executed, 0 missed, 7 excluded, 40 ignored

  1. """Models for the ``image_gallery`` app."""
  2. from django.db import models
  3. from django.utils.translation import ugettext_lazy as _
  4. from cms.models import CMSPlugin
  5. from cms.models.fields import PlaceholderField
  6. from filer.fields.folder import FilerFolderField
  7. class Gallery(models.Model):
  8. """
  9. Model to display a filer folder's contents and provide extra information.
  10. :title: Gallery title.
  11. :date: Date/Time of the gallery event.
  12. :location: Location of the gallery items.
  13. :description: Description of the gallery.
  14. :folder: Linked folder of the filer app.
  15. """
  16. title = models.CharField(
  17. max_length=100,
  18. verbose_name=_('Title'),
  19. )
  20. date = models.DateTimeField(
  21. verbose_name=_('Date'),
  22. blank=True, null=True,
  23. )
  24. location = models.CharField(
  25. max_length=100,
  26. verbose_name=_('Location'),
  27. blank=True, null=True,
  28. )
  29. description = PlaceholderField(
  30. 'description',
  31. verbose_name=_('Description'),
  32. )
  33. folder = FilerFolderField(
  34. verbose_name=_('Folder'),
  35. )
  36. def __unicode__(self):
  37. return '{0}'.format(self.title)
  38. class GalleryPlugin(CMSPlugin):
  39. """Plugin model to link to a specific gallery instance."""
  40. gallery = models.ForeignKey(
  41. Gallery,
  42. verbose_name=_('Gallery'),
  43. )