Closed bmampaey closed 6 years ago
xs:hexBinary
should be treated different from xs:base64Binary
which is mapped to BinaryField
.You are correct that xs:base64Binary and xs:hexBinary should map to the same type. I have committed your suggestion in that sense.
What is debatable is wether both should be mapped to the BinaryField or the CharField.
Mapping to BinaryField seems logical but it implicates that conversion is needed from the xml value to the model field value and vice versa. And it is not possible to use it in ModelForm see Django Doc.
Mapping to CharField does not represent correctly the intention of the schema. But it is simpler: no conversion needed and can be used in ModelForm.
The solution may be to simply let the user choose by adding a BASETYPE_OVERRIDES option in xsd_to_django_model_settings.py. It would also have the advantage to let the user easily add any missing type. I will write a patch for this.
Thanks!
I propose to add support for the xs:hexBinary type by mapping it to a CharField.