shorten slug when submitting entry
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 20 Nov 2012 08:55:39 +0000 (09:55 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 20 Nov 2012 08:55:39 +0000 (09:55 +0100)
migdal/forms.py

index 7c93ea8..63eba61 100644 (file)
@@ -34,7 +34,7 @@ def get_submit_form(*args, **kwargs):
         def clean(self):
             data = super(SubmitForm, self).clean()
             data['type'] = app_settings.TYPE_SUBMIT
         def clean(self):
             data = super(SubmitForm, self).clean()
             data['type'] = app_settings.TYPE_SUBMIT
-            orig_slug = slughifi(data.get('title_%s' % lang, ''))
+            orig_slug = slughifi(data.get('title_%s' % lang, ''))[:47]
             slug = orig_slug
             number = 2
             while Entry.objects.filter(**{'slug_%s' % lang: slug}).exists():
             slug = orig_slug
             number = 2
             while Entry.objects.filter(**{'slug_%s' % lang: slug}).exists():