mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-01 19:10:12 +03:00
remove urlpatterns = format_suffix_patterns(urlpatterns)
if i use If I use DefaultRouter, the original urlpatterns = format_suffix_patterns(urlpatterns) need to be removed, otherwise the error message will be as follows: django.core.exceptions.ImproperlyConfigured: "^snippets\.(?P<format>[a-z0-9]+)/?\.(?P<format>[a-z0-9]+)/?$ " is not a valid regular expression: redefinition of group name 'format' as group 2; was group 1 at position 40 Performing system checks...
This commit is contained in:
parent
5a54f897ec
commit
b715996037
|
@ -121,7 +121,7 @@ Here's our re-wired `snippets/urls.py` file.
|
|||
|
||||
Registering the viewsets with the router is similar to providing a urlpattern. We include two arguments - the URL prefix for the views, and the viewset itself.
|
||||
|
||||
The `DefaultRouter` class we're using also automatically creates the API root view for us, so we can now delete the `api_root` method from our `views` module.
|
||||
The `DefaultRouter` class we're using also automatically creates the API root view for us, so we can now delete the `api_root` method and `format_suffix_patterns` from our `views` module.
|
||||
|
||||
## Trade-offs between views vs viewsets
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user