We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
class PreferedContactWay(models.TextChoices): PHONE_CALL = "PHONE_CALL", _("PHONE_CALL") EMAIL = "EMAIL", _("EMAIL") PHONE_MESSAGE = "PHONE_MESSAGE", _("PHONE_MESSAGE") WHATS_APP = "WHATS_APP", _("WHATS_APP" Class PreferedContactWay(models.Model): prefered_contact_way: Annotated[models.CharField, PreferedContactWay] = models.CharField( max_length=253, verbose_name=_("Prefered way to contact"), null=True, blank=True, choices=PreferedContactWay, ) class Meta: verbose_name = _("Abstract Contact Info") verbose_name_plural = _("Abstract Contact Info") abstract = True Class Contact1(PreferedContactWay): ...
This code when generating proto do not transform prefered_contact_way field into an enum.
A way around for now is to redefine the field in the serializer like this:
class Contact1ProtoSerializer(proto_serializers.ModelProtoSerializer): prefered_contact_way: Annotated[serializers.ChoiceField, PreferedContactWay] = ( serializers.ChoiceField(choices=PreferedContactWay) ) class Meta: model = Contact1 fields = [ "prefered_contact_way", ... ]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This code when generating proto do not transform prefered_contact_way field into an enum.
A way around for now is to redefine the field in the serializer like this:
The text was updated successfully, but these errors were encountered: