[Django] #32598: Issue in models.SlugField

4 views
Skip to first unread message

Django

unread,
Mar 27, 2021, 4:51:53 AM3/27/21
to django-...@googlegroups.com
#32598: Issue in models.SlugField
---------------------------------------+------------------------
Reporter: MojixCoder | Owner: nobody
Type: Bug | Status: new
Component: Core (URLs) | Version: 3.1
Severity: Normal | Keywords: slug
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------+------------------------
After setting allow_unicode=True for a SlugField in Our models we cant
still use persian slugs because in <slug:slug> it doesn't accept unicode
slugs ( take a look at slug regex ).

path('<slug:slug>/', CategoryArticlesView.as_view(), name="category"),
Reverse for 'category' with arguments '('برنامه-نویسی',)' not found. 1
pattern(s) tried: ['articles/(?P<slug>[-a-zA-Z0-9_]+)/$']

remember than allow_unicode=True is working fine in SlugField but url
<slug:slug> doesn't accept it

--
Ticket URL: <https://code.djangoproject.com/ticket/32598>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 27, 2021, 7:57:49 AM3/27/21
to django-...@googlegroups.com
#32598: Issue in models.SlugField
-----------------------------+--------------------------------------
Reporter: MojixCoder | Owner: nobody
Type: Bug | Status: closed

Component: Core (URLs) | Version: 3.1
Severity: Normal | Resolution: invalid

Keywords: slug | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => invalid


Comment:

`SlugField.allow_unicode` doesn't impact path converters. It is also
[https://docs.djangoproject.com/en/3.1/topics/http/urls/#path-converters
documented] that:

> ''**slug** - Matches any slug string consisting of **ASCII letters or
numbers**, plus the hyphen and underscore characters. For example,
building-your-1st-django-site.''

You can create a custom path converter or use `re_path()`.

--
Ticket URL: <https://code.djangoproject.com/ticket/32598#comment:1>

Reply all
Reply to author
Forward
0 new messages