i want to iterate through the fields in ModelSerializer and want to make those field required . this not working . how can i do that. Somebody please help me.
class CustomerSerializer(serializers.ModelSerializer):
class Meta:
model = Customer
fields = ("email", "phone_no", "full_name", "landline_no")
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for field in self.fields:
self.fields[field].required = True
self.fields[field].allow_blank = False