Mohamed Feddad

39%
Flag icon
For example, the ^year/(\d+)/ pattern will send the value 1980 as the second argument (the first being the request) to the view. The problem with positional arguments is that it is very easy to mix up the order. Hence, we have name-based arguments where each captured value can be named. Our example will now look like ^year/(?P<year>\d+)/. This means that the view will be called with a keyword argument year being equal to 1980.
Django Design Patterns and Best Practices: Industry-standard web development techniques and solutions using Python, 2nd Edition
Rate this book
Clear rating