mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-14 05:36:50 +03:00
commit
cd5772174e
|
@ -105,7 +105,7 @@ using the `GenericAPIView` class based views.
|
||||||
|
|
||||||
class UserListView(generics.ListAPIView):
|
class UserListView(generics.ListAPIView):
|
||||||
queryset = User.objects.all()
|
queryset = User.objects.all()
|
||||||
serializer = UserSerializer
|
serializer_class = UserSerializer
|
||||||
filter_backends = (filters.DjangoFilterBackend,)
|
filter_backends = (filters.DjangoFilterBackend,)
|
||||||
|
|
||||||
## Filtering and object lookups
|
## Filtering and object lookups
|
||||||
|
@ -257,7 +257,7 @@ The `SearchFilter` class will only be applied if the view has a `search_fields`
|
||||||
|
|
||||||
class UserListView(generics.ListAPIView):
|
class UserListView(generics.ListAPIView):
|
||||||
queryset = User.objects.all()
|
queryset = User.objects.all()
|
||||||
serializer = UserSerializer
|
serializer_class = UserSerializer
|
||||||
filter_backends = (filters.SearchFilter,)
|
filter_backends = (filters.SearchFilter,)
|
||||||
search_fields = ('username', 'email')
|
search_fields = ('username', 'email')
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ A complete example using both `DjangoObjectPermissionsFilter` and `DjangoObjectP
|
||||||
'change' or 'delete' permissions.
|
'change' or 'delete' permissions.
|
||||||
"""
|
"""
|
||||||
queryset = Event.objects.all()
|
queryset = Event.objects.all()
|
||||||
serializer = EventSerializer
|
serializer_class = EventSerializer
|
||||||
filter_backends = (filters.DjangoObjectPermissionsFilter,)
|
filter_backends = (filters.DjangoObjectPermissionsFilter,)
|
||||||
permission_classes = (myapp.permissions.CustomObjectPermissions,)
|
permission_classes = (myapp.permissions.CustomObjectPermissions,)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user