1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

FieldChoicesViewSet should infer field choices from serializer, not model

This commit is contained in:
Jeremy Stretch
2019-03-22 16:24:53 -04:00
parent 7d1ee2e94e
commit fc76c8eb0f
6 changed files with 26 additions and 11 deletions

View File

@ -1,3 +1,4 @@
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from rest_framework import serializers
from taggit.models import Tag
@ -88,7 +89,9 @@ class TagSerializer(ValidatedModelSerializer):
#
class ImageAttachmentSerializer(ValidatedModelSerializer):
content_type = ContentTypeField()
content_type = ContentTypeField(
queryset=ContentType.objects.all()
)
parent = serializers.SerializerMethodField(read_only=True)
class Meta: