1. Kai Diefenbach
  2. django-lfs
  3. Issues
Issue #175 new

Workaround for django.template.defaultfilters.slugify bug

Denis Vasiliev
created an issue

There is an old bug in django with slugify filter and natioinal symbols. ( https://code.djangoproject.com/ticket/8391 )

Could you use proposed function ( https://code.djangoproject.com/ticket/8391#comment:35 ) instead of default django slugify function?

Problem is here - https://bitbucket.org/diefenbach/django-lfs/src/03b1c573d504/lfs/manage/product/variants.py#cl-386

Comments (3)

  1. Kai Diefenbach repo owner

    I haven't read the whole ticket yet, but maybe you can give me some pointers in advance:

    • Why is that not fixed in Django core?
    • Why is proposed slugify2 not used in Django core?
    • Are there any side effects?

    Thanks Kai

  2. Denis Vasiliev reporter

    1) Why is that not fixed in Django core? 2) Why is proposed slugify2 not used in Django core?

    To say the Truth - I don't know. They agreed on the fact, that this feature should be implemented that way (exactly the same way it's done in JS). Than somebody proposed implementation and since then nobody did anything. May be it's just low priority feature and developers are just busy.

    3) Are there any side effects?

    It's a bit slower (since it uses regexp). On strings, that contain only normal latin symbols, it does exactly the same effect. On strings, that contain national symbols it performs way better, cause current slugify just drops this symbols from input string.

  3. Maciej Wiśniowski

    I think that it is not fixed in Django core because there is no patch yet. There is only an implementation on someone's else fork and it doesn't have any tests.

    I've used another implementation of slugify (for the same reason): http://trac.django-fr.org/browser/site/trunk/project/links/slughifi.py?rev=47

    and it worked (and still works) without problems.

    In general I think that would be nice to have it in LFS but also feel free to prepare patch against django trunk :)

  4. Log in to comment