equal
deleted
inserted
replaced
|
1 from django.db import models |
|
2 from django.contrib.sites.models import Site |
|
3 from django.utils.translation import ugettext_lazy as _ |
|
4 |
|
5 |
|
6 class FlatPage(models.Model): |
|
7 url = models.CharField(_('URL'), max_length=100, db_index=True) |
|
8 title = models.CharField(_('title'), max_length=200) |
|
9 content = models.TextField(_('content'), blank=True) |
|
10 enable_comments = models.BooleanField(_('enable comments')) |
|
11 template_name = models.CharField(_('template name'), max_length=70, blank=True, |
|
12 help_text=_("Example: 'flatpages/contact_page.html'. If this isn't provided, the system will use 'flatpages/default.html'.")) |
|
13 registration_required = models.BooleanField(_('registration required'), help_text=_("If this is checked, only logged-in users will be able to view the page.")) |
|
14 sites = models.ManyToManyField(Site) |
|
15 |
|
16 class Meta: |
|
17 db_table = 'django_flatpage' |
|
18 verbose_name = _('flat page') |
|
19 verbose_name_plural = _('flat pages') |
|
20 ordering = ('url',) |
|
21 |
|
22 def __unicode__(self): |
|
23 return u"%s -- %s" % (self.url, self.title) |
|
24 |
|
25 def get_absolute_url(self): |
|
26 return self.url |