You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from rest_framework import serializers
from .models import ColorProduct, ImageProduct
from drf_writable_nested.serializers import WritableNestedModelSerializer
class ImageSerializers(serializers.ModelSerializer):
class Meta:
model= ImageProduct
fields= ['image']
class ColorSerializers(WritableNestedModelSerializer):
images= ImageSerializers(many= True)
class Meta:
model= ColorProduct
fields= '__all__'
Views.py
from django.shortcuts import render
from rest_framework.parsers import MultiPartParser, FormParser
from rest_framework import viewsets
from .serializers import ColorSerializers
from .models import ColorProduct
class ProductModelViewSet(viewsets.ModelViewSet):
parser_classes= [MultiPartParser, FormParser]
queryset= ColorProduct.objects.all()
serializer_class = ColorSerializers
When i create, its okay. But update, the images field return empty
Ex: Return
I have adready config MEDIA_URL, MEDIA_ROOT in setting.py
Models.py
Serializers.py
Views.py
When i create, its okay. But update, the images field return empty
Ex: Return
The text was updated successfully, but these errors were encountered: