|
|
|
@ -199,11 +199,15 @@ class GallerySerializer(serializers.ModelSerializer): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ContentSerializer(serializers.ModelSerializer): |
|
|
|
class ContentSerializer(serializers.ModelSerializer): |
|
|
|
|
|
|
|
type = serializers.SerializerMethodField() |
|
|
|
|
|
|
|
|
|
|
|
class Meta: |
|
|
|
class Meta: |
|
|
|
model = Content |
|
|
|
model = Content |
|
|
|
fields = BASE_CONTENT_FIELDS |
|
|
|
fields = BASE_CONTENT_FIELDS |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_type(self, object): |
|
|
|
|
|
|
|
return 'content' |
|
|
|
|
|
|
|
|
|
|
|
def to_representation(self, obj): |
|
|
|
def to_representation(self, obj): |
|
|
|
if isinstance(obj, Image): |
|
|
|
if isinstance(obj, Image): |
|
|
|
return ImageSerializer(obj, context=self.context).to_representation(obj) |
|
|
|
return ImageSerializer(obj, context=self.context).to_representation(obj) |
|
|
|
|