[Django]-Get ID of Django record after it has been created in a ModelViewSet

9👍

Calling serializer.save() should return the instance that has just been create.

instance = serializer.save(...)

instance_id = instance.id

3👍

serializer.save() returns a Photo object, at which point you can access its id.

Leave a comment