python
Django update model with for loop
def update(self, instance, validated_data):
for attr, value in validated_data.items():
setattr(instance, attr, value)
instance.save()
return instance
Was this helpful?
Similar Posts