Django

Code

root/django/branches/newforms-admin/django/contrib/flatpages/models.py

Revision 7953, 1.3 kB (checked in by brosner, 5 months ago)

newforms-admin: Moved contrib ModelAdmin? classes to an admin.py file in their respective apps. This is allowed since [7872].

  • Property svn:eol-style set to native
Line 
1 from django.core import validators
2 from django.db import models
3 from django.contrib.sites.models import Site
4 from django.utils.translation import ugettext_lazy as _
5
6
7 class FlatPage(models.Model):
8     url = models.CharField(_('URL'), max_length=100, validator_list=[validators.isAlphaNumericURL], db_index=True,
9         help_text=_("Example: '/about/contact/'. Make sure to have leading and trailing slashes."))
10     title = models.CharField(_('title'), max_length=200)
11     content = models.TextField(_('content'), blank=True)
12     enable_comments = models.BooleanField(_('enable comments'))
13     template_name = models.CharField(_('template name'), max_length=70, blank=True,
14         help_text=_("Example: 'flatpages/contact_page.html'. If this isn't provided, the system will use 'flatpages/default.html'."))
15     registration_required = models.BooleanField(_('registration required'), help_text=_("If this is checked, only logged-in users will be able to view the page."))
16     sites = models.ManyToManyField(Site)
17
18     class Meta:
19         db_table = 'django_flatpage'
20         verbose_name = _('flat page')
21         verbose_name_plural = _('flat pages')
22         ordering = ('url',)
23    
24     def __unicode__(self):
25         return u"%s -- %s" % (self.url, self.title)
26
27     def get_absolute_url(self):
28         return self.url
Note: See TracBrowser for help on using the browser.