Skip to content

Commit

Permalink
Update URL routing examples in usage guide. (#1339)
Browse files Browse the repository at this point in the history
  • Loading branch information
carltongibson committed Mar 7, 2021
1 parent 2d30f31 commit b1e37af
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/guide/usage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ The URL conf

We need a URL pattern to call the view::

url(r'^list$', views.product_list)
path('list/', views.product_list, name="product-list")


The template
Expand Down Expand Up @@ -305,12 +305,12 @@ You must provide either a ``model`` or ``filterset_class`` argument, similar to
``ListView`` in Django itself::

# urls.py
from django.conf.urls import url
from django.urls import path
from django_filters.views import FilterView
from myapp.models import Product

urlpatterns = [
url(r'^list/$', FilterView.as_view(model=Product)),
path("list/", FilterView.as_view(model=Product), name="product-list"),
]

If you provide a ``model`` optionally you can set ``filterset_fields`` to specify a list or a tuple of
Expand All @@ -326,12 +326,12 @@ its use is deprecated. It can be found at
to it as the class based view::

# urls.py
from django.conf.urls import url
from django.urls import path
from django_filters.views import object_filter
from myapp.models import Product

urlpatterns = [
url(r'^list/$', object_filter, {'model': Product}),
path("list/', object_filter, {'model': Product}, name="product-list),
]

The needed template and its context variables will also be the same as the
Expand Down

0 comments on commit b1e37af

Please sign in to comment.