PageRenderTime 15ms CodeModel.GetById 12ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/django/contrib/redirects/models.py

https://code.google.com/p/mango-py/
Python | 20 lines | 17 code | 3 blank | 0 comment | 0 complexity | 422e24962ccbd8a5e5fca0bbf2e6c73e MD5 | raw file
 1from django.db import models
 2from django.contrib.sites.models import Site
 3from django.utils.translation import ugettext_lazy as _
 4
 5class Redirect(models.Model):
 6    site = models.ForeignKey(Site)
 7    old_path = models.CharField(_('redirect from'), max_length=200, db_index=True,
 8        help_text=_("This should be an absolute path, excluding the domain name. Example: '/events/search/'."))
 9    new_path = models.CharField(_('redirect to'), max_length=200, blank=True,
10        help_text=_("This can be either an absolute path (as above) or a full URL starting with 'http://'."))
11
12    class Meta:
13        verbose_name = _('redirect')
14        verbose_name_plural = _('redirects')
15        db_table = 'django_redirect'
16        unique_together=(('site', 'old_path'),)
17        ordering = ('old_path',)
18    
19    def __unicode__(self):
20        return "%s ---> %s" % (self.old_path, self.new_path)