Skip to content

Commit

Permalink
getting rid of the django.contrib.redirects model
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Schoen committed Apr 13, 2011
1 parent a1940de commit c5fee55
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions cms_redirects/models.py
@@ -1,9 +1,23 @@
from django.contrib.redirects.models import Redirect
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models.fields import PageField

from cms.models import Page

class CMSRedirect(Redirect):
class CMSRedirect(models.Model):
page = PageField(verbose_name=_("page"), blank=True, null=True, help_text=_("A link to a page has priority over a text link."))
site = models.ForeignKey(Site)
old_path = models.CharField(_('redirect from'), max_length=200, db_index=True,
help_text=_("This should be an absolute path, excluding the domain name. Example: '/events/search/'."))
new_path = models.CharField(_('redirect to'), max_length=200, blank=True,
help_text=_("This can be either an absolute path (as above) or a full URL starting with 'http://'."))

class Meta:
verbose_name = _('redirect')
verbose_name_plural = _('redirects')
db_table = 'django_redirect'
unique_together=(('site', 'old_path'),)
ordering = ('old_path',)

def __unicode__(self):
return "%s ---> %s" % (self.old_path, self.new_path)
2 changes: 1 addition & 1 deletion setup.py
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import os

version = __import__('multimedia').__version__
version = __import__('cms_redirects').__version__

install_requires = [
'setuptools',
Expand Down

0 comments on commit c5fee55

Please sign in to comment.