#34567 closed New feature (duplicate)
slugify template filter with allow_unicode
Reported by: | benjaoming | Owned by: | Arthur Moreira |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Currently, the slugify template filter in defaultfilters
doesn't handle the allow_unicode
from django.utils.text.slugify
. This should be trivial to add and be beneficial for languages that won't have characters normally converted to ASCII.
Could this be implemented as an argument for the default template filter? Or a separate default template filter?
Which version would be preferred?
{{ value|slugify:allow_unicode=True }}
or
{{ value|slugify_unicode }}
?
Change History (4)
comment:1 by , 20 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → New feature |
comment:2 by , 20 months ago
Component: | Uncategorized → Template system |
---|---|
Resolution: | → duplicate |
Status: | assigned → closed |
Triage Stage: | Accepted → Unreviewed |
Duplicate of #8391. Also, the current thread is to keep Django a core framework, not providing every utility which might be useful. You can write that filter in your own library. You can start a discussion about #8391 on DevelopersMailingList if you don't agree.
follow-up: 4 comment:3 by , 20 months ago
Duplicate of #8391.
Thanks Mariusz, I did look at that issue, and I should have noted it in the description - but I think #8391 is from before django.utils.text.slugify existed and provided allow_unicode. The previous issue was mostly about the complex area of mapping one character to another - allow_unicode=True doesn't want to map anything AFAIK.
Also, the current thread is to keep Django a core framework, not providing every utility which might be useful.
That's fair. The functionality is already implemented in django.utils.text - so this is only a proposal to expose the keyword allow_unicode
. But yeah, exposing it will of course lead to more usage.
I was particularly intrigued by the fact that I had introduced bugs in my codebase because I used |slugify
without considering its affect on translated versions.
You can start a discussion about #8391 on DevelopersMailingList if you don't agree.
That's a nice page <3 I have been "WONTFIX'ed" :) I don't feel like having a discussion on this topic. I tried to write a topic for the forum, but it became disproportionate -- adding the keyword to the template filter is both very easy to implement in Django defaultfilters, it's also very easy to port my own boilerplate around between projects. If it cannot be a quick yes/no, then I think leaving it aside is better.
comment:4 by , 20 months ago
Replying to benjaoming:
That's a nice page <3 I have been "WONTFIX'ed" :) I don't feel like having a discussion on this topic. I tried to write a topic for the forum, but it became disproportionate -- adding the keyword to the template filter is both very easy to implement in Django defaultfilters, it's also very easy to port my own boilerplate around between projects. If it cannot be a quick yes/no, then I think leaving it aside is better.
Not you, it's been "wontfixed" 9 years ago ;) I'm just trying to keep a discussion in a single place 🧹. TBH, I'm fine with exposing allow_unicode
in the slugify
template filter but we should do this by reopening #8391. You can start a short thread on the Django Forum or the mailing list, a few "+1" should be enough to reopen.
Reproduced.
but given following context
in the template
it produces
i agree that a way to allow unicode from the template filter should exist with
slugify_unicode