Hello I am new to django and I am using django-rest-framework for making res APIs. Is there any hook or any Signals like django for executing a callback on pre validation state?
I need to prepopulate some data outside the admin area before the validation and then I am doing this stuff:
if serializer.is_valid():
serializer.save()
Here is my serializer class:
class HeroSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Hero
fields = ['name', 'alias', 'gender']
Do I need another serializer for write operations? or should I create a custom Signal for it? Please suggest me an efficient way to do this.