Loading…

Django 2.0 url() to path() cheatsheet

Django 2.0 introduced a new way to define URLs, which greatly simplifies how parameters are captured. In earlier versions of Django, you had to use the url() method and pass a regular expressions with named capturing groups to capture URL parameters. url(r’^posts/(?P<post_id>[0-9]+)/$’, post_detail_view) In Django 2.0, you use the path() method with path converters to […]