PageRenderTime 82ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

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