Permalink
Browse files

getting rid of the django.contrib.redirects model

  • Loading branch information...
1 parent a1940de commit c5fee554b50070164ce514cb2b2ed2b23fe35fcf Andrew Schoen committed Apr 13, 2011
Showing with 17 additions and 3 deletions.
  1. +16 −2 cms_redirects/models.py
  2. +1 −1 setup.py
View
@@ -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)
View
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import os
-version = __import__('multimedia').__version__
+version = __import__('cms_redirects').__version__
install_requires = [
'setuptools',

0 comments on commit c5fee55

Please sign in to comment.