Monday, October 25, 2010

Re: Slug auto-complete after save

Hi Alex,

2010/10/25 Alex <personxxl@gmail.com>
File "admin_modify.py" method "def prepopulated_fields_js(context)"
Line 11:

if context['add'] and 'adminform' in context:

should be changed to

if 'adminform' in context:

to allow slug be auto updated every time and not only on the entity
creation in admin.

Is there any setting to do it without changing Django internal source
code?

Well, yes, you should not modify source code of external project unless you have a really good reason to.

A way to fix this would be to write your own field type or at least own widget. My approach to 'slugification' is CentralniakSlugField (http://github.com/centralniak/django-centralniak-slugfield). It does not allow real-time js autoslugs (slug are done in background when saving) however, since the widget is a simple text field.

I guess there might already be a better slug solution on the web.

Regards, PK

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment