I have some models like these:
class TypeBase(models.Model):
name = models.CharField(max_length=20)
class Meta:
abstract=True
class PersonType(T
Just iterating a bit over @adki's answer:
class TypeBaseSerializer(serializers.Serializer): class Meta: fields = ('id', 'name', 'created') abstract = True def func(...): # ... some logic class PersonTypeSerializer(TypeBaseSerializer): class Meta: model = PersonType fields = TypeBaseSerializer.Meta.fields + ('age', 'date_of_birth') class CompanyTypeSerializer(TypeBaseSerializer): class Meta: model = CompanyType fields = TypeBaseSerializer.Meta.fields