views.py 582 B

12345678910111213141516171819202122
  1. from __future__ import unicode_literals, print_function
  2. from rest_framework_bulk import generics
  3. from . import models
  4. class SimpleBulkAPIView(generics.ListBulkCreateUpdateDestroyAPIView):
  5. model = models.SimpleModel
  6. class FilteredBulkAPIView(generics.ListBulkCreateUpdateDestroyAPIView):
  7. model = models.SimpleModel
  8. def filter_queryset(self, queryset):
  9. return queryset.filter(number__gt=5)
  10. class SimpleViewSet(generics.BulkModelViewSet):
  11. model = models.SimpleModel
  12. def filter_queryset(self, queryset):
  13. return queryset.filter(number__gt=5)