Closed EnriqueSoria closed 3 years ago
It looks like DataclassSerializer can't handle properties automatically. It would be great to make this possible:
@dataclass class PricingInfo: original_price_incl_tax: Decimal @property def original_price(self) -> Decimal: """Backwards compatibility""" return self.original_price_incl_tax
class PricingInfoSerializer(DataclassSerializer): class Meta: dataclass = PricingInfo fields = ( "original_price", )
The field 'original_price' was included on serializer PricingInfoSerializer in the `fields` option, but does not match any dataclass field.
Thanks!
It looks like DataclassSerializer can't handle properties automatically. It would be great to make this possible: