Django Rest Framework Getting serializer from model

Published: 11/02/2019
Django Rest Framework Getting serializer from model
Source: STACKOVERFLOW.COM

I am looking for a way to get a serializer from a model class. This is so that I can easily serialize model data, without having to harcode the serializer name and I figured something like this would do: #mymodels.py from django.db import models import myserializers class Model(models.Model): name = models.CharField(max_length=50) serializer = serializers.Serializer #myserializers.py from rest_fra

Read more
Related news
Comment
FACEBOOK