Frank Becker avatar Frank Becker committed ccf97d0

removed my own error-prone slugify funct and refactored in the Django one

Comments (0)

Files changed (2)

src/submitter/models.py

 from markdown import markdown
 from django.db import models, IntegrityError
 from django.utils.translation import ugettext_lazy as _
+from django.template.defaultfilters import slugify
 from django.contrib.auth.models import User
 from django.conf import settings
 from django.core.files import File
     return re.sub('&(%s);' % '|'.join(name2codepoint),
             lambda m: unichr(name2codepoint[m.group(1)]), s)
 
-def slugify(value):
+def slugify_old(value):
     """
     Normalizes string, converts to lowercase, removes non-alpha characters,
     and converts spaces to hyphens.

src/submitter/tests/models.py

         self.assert_(self.entry_category2 in self.news_entry1.categories.all())
         self.assert_(u'Foo'.lower() in [ t.name for t in self.news_entry1.tags])
         self.assert_(u'Bar'.lower() in self.news_entry1.get_tag_list())
-        self.assertEquals(self.news_entry1.slug, u"fridolingotking")
+        self.assertEquals(self.news_entry1.slug, u"fridolin-got-king")
         self.assertEquals(
             self.news_entry1.get_absolute_url(),
-            '/submit/%(year)s/%(month)s/%(day)s/fridolingotking/' % (
+            '/submit/%(year)s/%(month)s/%(day)s/fridolin-got-king/' % (
                 {'year': self.date_test.strftime("%Y"),
                  'month': self.date_test.strftime("%m"),
                  'day': self.date_test.strftime("%d"),
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.