I've a model where few fields are auto-generated. How do I hide those fields from the Swagger UI during POST request? Following is the example:-
class ModelX(models.Model):
a = models.CharField()
b = models.CharField()
c = models.CharField()
d = models.CharField()
Below is my serialzer:-
class Serializerx(serializers.Serializer):
class Meta:
model = ModelX
fields = '__all__
In the above model, fields b and d are auto generated from my code, which means these fields are not required as an input from the user.
If I add b and d as read-only fields, then I wont be able to create an object with these values.
How do I hide some attributes from the payload request.? Somewhat similar to this