Closed ajt closed 12 years ago
Which version of Django and django-categories are you using? I can't replicate it using 0.8.4 and Django 1.3. The slugify method automatically stops after 50 characters.
Hey there,
I am on django 1.3.1 and django-categories 0.8.4:
(quizbowl)ajt@li181-64:~/quizbowl/quizbowl$ django-admin.py --version 1.3.1 (quizbowl)ajt@li181-64:~/quizbowl/quizbowl$ pip freeze Django==1.3.1 Markdown==2.0.3 MySQL-python==1.2.3 South==0.7.3 distribute==0.6.15 django-categories==0.8.4 django-mptt==0.4.2 wsgiref==0.1.2
Here is the string that I am trying to use as a title (under a parent category CISSP): Information Security Governance and Risk Management
When I try to create a sub category named "Information Security Governance and Risk Management" I get an error on the slug field, saying that I need to "Ensure this value has at most 50 characters (it has 51)." I can modify the slug field to any number of characters less than 50 and I get the same error. If I remove the slug completely I get an error. A screenshot can be found at http://loldon.gs/coordt.png. I appreciate any help you can give. Let me know if you need more info.
This is very strange. I still can't replicate it. Using your data, the slug automatically was set to : information-security-governance-and-risk-managemen
My initial guess is that the slug may be only get set after the form is submitted, which may mean that some of Django's admin JS isn't loading correctly.
Could you try modifying line 44 of the admin.py to truncate the slug:
return self.cleaned_data['slug'][:50]
Let me know if this solves your issue and I'll update the code.
Hey coordt, sorry for the hold up on this. Your fix worked. Thanks for your help.
When you use a title that has more than 50 characters a slug is created within the advanced section of the admin panel. Even when you edit this slug to contain less than 50 characters, the application will still give you an error as if there are still too many characters.