#Custom serializer django rest framework how to#How to create a new user with django rest framework and custom user model.Django Rest Framework - Override serializer create method for model with self-referential M2M field.Django Rest Framework Serializer Model Custom Method with parameters.For example: Models class Sample(models.Model): Serializers class SampleSerializer(serializers.ModelSerializer):Īnother possible way of doing this is to create two separate properties (that explicitly call the sample_method with the value x or y) on your model itself and simply use the names as fields in your serializer. Name = models.CharField(max_length=100, default=None) You can try using the SerializerMethodField as follows if the values x and y are static: Models class Sample(models.Model):
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |