PageRenderTime 226ms CodeModel.GetById 121ms app.highlight 3ms RepoModel.GetById 97ms app.codeStats 1ms

/django/contrib/flatpages/models.py

https://code.google.com/p/mango-py/
Python | 26 lines | 21 code | 5 blank | 0 comment | 0 complexity | 39a82cb5f976889edf73cbc4f77f05d3 MD5 | raw file
 1from django.db import models
 2from django.contrib.sites.models import Site
 3from django.utils.translation import ugettext_lazy as _
 4
 5
 6class 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