Fix django polymorphic on django 1.9

This commit is contained in:
Frank Hamand 2017-03-02 17:12:21 +00:00
parent cea9176f2e
commit 1d263b1173
3 changed files with 5 additions and 10 deletions

View File

@ -36,17 +36,12 @@ def create_viewset(arg_model, arg_fields, arg_read_only_fields=(), no_create=Fal
else:
viewset_class = viewsets.ModelViewSet
arg_queryset = None
if issubclass(arg_model, PolymorphicModel):
arg_queryset = arg_model.objects.instance_of(arg_model)
else:
arg_queryset = arg_model.objects.all()
class ViewSet(viewset_class):
queryset = arg_queryset
queryset = arg_model.objects
serializer_class = Serializer
ordering = ['id']
filter_fields = arg_fields
return ViewSet
check_group_mixin_fields = (

View File

@ -255,7 +255,7 @@ REST_FRAMEWORK = {
'rest_framework.permissions.DjangoModelPermissions',
],
'DEFAULT_FILTER_BACKENDS': [
'rest_framework.filters.DjangoFilterBackend',
'django_filters.rest_framework.DjangoFilterBackend',
'rest_framework.filters.OrderingFilter',
]
}

View File

@ -7,12 +7,12 @@ django-appconf==1.0.2
django-auth-ldap==1.2.6
django-celery==3.1.17
django-compressor==2.1.1
django-filter==0.13
django-filter==1.0.1
django-jsonify==0.3.0
django-mptt==0.6.0
django-polymorphic==1.1
Django>=1.9,<1.10
djangorestframework>=3.4,<3.5
djangorestframework>=3.5,<3.6
freezegun==0.3.8
gevent==1.0.1
gunicorn==19.6.0