You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8 年之前
1234567891011121314
  1. from api import models, serializers
  2. from api.permissions import IsOwner
  3. from rest_framework import permissions, viewsets
  4. class PasswordViewSet(viewsets.ModelViewSet):
  5. serializer_class = serializers.PasswordSerializer
  6. permission_classes = (permissions.IsAuthenticated, IsOwner,)
  7. search_fields = ('site', 'email',)
  8. ordering_fields = ('site', 'email', 'created')
  9. def get_queryset(self):
  10. return models.Password.objects.filter(user=self.request.user)