update bug

pull/530/head
ibuler 2016-11-24 19:36:49 +08:00
parent c1a74aebc5
commit 72ad4b44ce
3 changed files with 8 additions and 5 deletions

View File

@ -263,7 +263,6 @@ REST_FRAMEWORK = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': (
# 'rest_framework.permissions.IsAuthenticated',
'users.backends.IsValidUser',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
@ -273,6 +272,7 @@ REST_FRAMEWORK = {
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
),
'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',),
}
# Custom User Auth model

View File

@ -3,6 +3,7 @@
import base64
from rest_framework import filters
from django.shortcuts import get_object_or_404
from django.core.cache import cache
from django.conf import settings
@ -11,6 +12,7 @@ from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework_bulk import ListBulkCreateUpdateDestroyAPIView, BulkModelViewSet
from rest_framework import authentication
from django_filters.rest_framework import DjangoFilterBackend
from common.mixins import BulkDeleteApiMixin
from common.utils import get_logger
@ -28,9 +30,9 @@ class UserViewSet(BulkModelViewSet):
queryset = User.objects.all()
serializer_class = serializers.UserSerializer
permission_classes = (IsSuperUser,)
def allow_bulk_destroy(self, qs, filtered):
return qs is not filtered
filter_backends = (DjangoFilterBackend,)
# filter_fields = ('username', 'email', 'name', 'id')
ordering_fields = ('username', 'email')
class UserUpdateGroupApi(generics.RetrieveUpdateAPIView):

View File

@ -15,4 +15,5 @@ paramiko==2.0.2
django-redis-cache==1.7.1
requests==2.11.1
itsdangerous==0.24
unicodecsv==0.14.1
unicodecsv==0.14.1
django-filter==1.0.0