Django

Code

root/django/trunk/django/contrib/flatpages/models.py

Revision 8616, 1.1 kB (checked in by gwilson, 10 months ago)

Removed oldforms, validators, and related code:

  • Removed Manipulator, AutomaticManipulator, and related classes.
  • Removed oldforms specific bits from model fields:
    • Removed validator_list and core arguments from constructors.
    • Removed the methods:
      • get_manipulator_field_names
      • get_manipulator_field_objs
      • get_manipulator_fields
      • get_manipulator_new_data
      • prepare_field_objs_and_params
      • get_follow
    • Renamed flatten_data method to value_to_string for better alignment with its use by the serialization framework, which was the only remaining code using flatten_data.
  • Removed oldforms methods from django.db.models.Options class: get_followed_related_objects, get_data_holders, get_follow, and has_field_type.
  • Removed oldforms-admin specific options from django.db.models.fields.related classes: num_in_admin, min_num_in_admin, max_num_in_admin, num_extra_on_change, and edit_inline.
  • Serialization framework
    • Serializer.get_string_value now calls the model fields' renamed value_to_string methods.
    • Removed a special-casing of models.DateTimeField in core.serializers.base.Serializer.get_string_value that's handled by django.db.models.fields.DateTimeField.value_to_string.
  • Removed django.core.validators:
    • Moved ValidationError exception to django.core.exceptions.
    • For the couple places that were using validators, brought over the necessary code to maintain the same functionality.
  • Introduced a SlugField? form field for validation and to compliment the SlugField? model field (refs #8040).
  • Removed an oldforms-style model creation hack (refs #2160).
  • Property svn:eol-style set to native
Line 
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
Note: See TracBrowser for help on using the browser.