I am making a e-commerce like web application where users can upload 
advertisements and add multiple images to the advertisement. I can upload 
only one image but i want users to have the ability to add many images. Is 
there any way?

#Here is my model
class AdImage(models.Model):
    advertisement = models.ForeignKey(Advertisement, on_delete
= models.CASCADE)
    image = models.ImageField(upload_to='media/', null= True, blank=True)

#here is my serializer
class AdImageSerializer(serializers.ModelSerializer):

    class Meta:
        model = AdImage
        fields = "__all__"

#here is my viewset
class AdImageViewset(ModelViewSet):
    queryset = AdImage.objects.all()
    serializer_class = AdImageSerializer
    parser_classes = (MultiPartParser, FormParser,)

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-rest-framework/44329f35-b810-4413-a35e-d6514c009a80%40googlegroups.com.

Reply via email to