Great - thanks also for posting the answer here as well!

Regards.

Andréas


‪Den ons 6 maj 2020 kl 14:37 skrev ‫אורי‬‎ <[email protected]>:‬

> Hi,
>
> I checked and if I define a converter with a name of a default converter,
> such as "slug" - it overrides the default converter. The line that causes
> this is the line return {**DEFAULT_CONVERTERS, **REGISTERED_CONVERTERS}
>  in get_converters() in Django.
>
> אורי
> [email protected]
>
>
> On Wed, May 6, 2020 at 3:04 PM Andréas Kühne <[email protected]>
> wrote:
>
>> Hi,
>>
>> You register your converter in the main urls.py file (which is usually in
>> the main project name, alongside settings.py). That's all you need to do.
>>
>> I don't know about the slug converter though - I would just reregister it
>> and see what happens :)
>>
>> Regards,
>>
>> Andréas
>>
>>
>> ‪Den ons 6 maj 2020 kl 11:23 skrev ‫אורי‬‎ <[email protected]>:‬
>>
>>> Hi,
>>>
>>> Do I have to use register_converter in any file using it? I have a
>>> project with many urls.py files, and I want to register converters which
>>> will be used in multiple files. How do I register them? Do I have to
>>> register them in all the urls.py files? And where in my project should I
>>> put the converters definitions?
>>>
>>> Also, can I register a converter with the name "slug"? (which is also
>>> defined by Django). I want to define "slug" as any string containing
>>> letters a-z, A-Z, digits 0-9, "-", ".", or "_" (the 2 latest
>>> characters will be redirected to "-"). for example the paths
>>> "/uri_rodberg/" and "/uri.rodberg/" will be redirected to "/uri-rodberg/".
>>> And not to use the Django-defined "slug".
>>>
>>> I also want to define "digits" as any sequence of digits 0-9, but it's a
>>> string - not an integer. For example an ID of a user or entity. It can
>>> start with any numbers of leading zeros.
>>> אורי
>>> [email protected]
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CABD5YeHRp7rvqrBirbSObVFOsxwfDX%2BDnKoxraoq5Wyc4Fu84g%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CABD5YeHRp7rvqrBirbSObVFOsxwfDX%2BDnKoxraoq5Wyc4Fu84g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAK4qSCcprGp2LH6ox3Qu4s8svfriWq-3d9hLH8-bqqKsRYpbRQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAK4qSCcprGp2LH6ox3Qu4s8svfriWq-3d9hLH8-bqqKsRYpbRQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABD5YeHi07etdpqAevrpRAtZ_Mm%3DqgfXmH5OfbUtA1xXNXdd8Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABD5YeHi07etdpqAevrpRAtZ_Mm%3DqgfXmH5OfbUtA1xXNXdd8Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCdozH-aWFPyFwnR6y-3PURs08gRK27Qm0mp-RXijPfmZQ%40mail.gmail.com.

Reply via email to