3 ms·
How is <int:id> identical to (?P<year>[0-9]{4})? I'm talking about the {4}. Just an error in their blog post?
by switch007 9y ago
How is <int:id> identical to (?P<year>[0-9]{4})? I'm talking about the {4}. Just an error in their blog post?
- westurner 9y agoDoes it support negative long integers? EDIT: I am without actual internet or mobile tethering and an unable to `git clone https://github.com/django/django https://github.com/django/django -b stable/2.0.x` and check out this convenient new feature.
- whalesalad 9y agoSeriously? I mean you can achieve that with your own regex the old way. Surprised you’re asking the commenters here to investigate such a specific and odd use case of a convenience method.
- ubernostrum 9y agoIt's still regex under the hood, the 'int' is just syntactic sugar for "[0-9]+": https://github.com/django/django/blob/dda37675db0295baefef3750e12430cf9df4d835/django/urls/converters.py#L6 https://github.com/django/django/blob/dda37675db0295baefef37...
- westurner 9y agoThanks!
- lozenge 9y agoYou normally would want a three digit year to 404, and the same is true for a silly year like `3456` - you would 404 in the view. So, it isn't identical, but close enough for most purposes, as your view probably already has code to return 404.