- Added librarian as a submodule.
[wolnelektury.git] / apps / chunks / models.py
1 from django.db import models
2 from django.utils.translation import ugettext_lazy as _
3
4
5 class Chunk(models.Model):
6     """
7     A Chunk is a piece of content associated with a unique key that can be inserted into
8     any template with the use of a special template tag.
9     """
10     key = models.CharField(_('key'), help_text=_('A unique name for this chunk of content'), primary_key=True, max_length=255)
11     description = models.CharField(_('description'), blank=True, max_length=255)
12     content = models.TextField(_('content'), blank=True)
13
14     class Meta:
15         ordering = ('key',)
16         verbose_name = _('chunk')
17         verbose_name_plural = _('chunks')
18
19     def __unicode__(self):
20         return self.key
21
22
23 class Attachment(models.Model):
24     key = models.CharField(_('key'), help_text=_('A unique name for this attachment'), primary_key=True, max_length=255)
25     attachment = models.FileField(upload_to='chunks/attachment')
26
27     class Meta:
28         ordering = ('key',)
29         verbose_name, verbose_name_plural = _('attachment'), _('attachments')
30
31     def __unicode__(self):
32         return self.key
33