Came across this when using django-enumfields, which registers a custom type descriptor. This change preserves that behaviour for CompositeType. This should also work for the standard FileField.
The implementation fakes a model based on the fields declared in the CompositeType subclass to get type descriptors (if any) out of the fields. This ended up being much cleaner and simpler than trying to fake what's required to call Field.contribute_to_class with a CompositeType as the class.
Came across this when using django-enumfields, which registers a custom type descriptor. This change preserves that behaviour for
CompositeType
. This should also work for the standardFileField
.The implementation fakes a model based on the fields declared in the
CompositeType
subclass to get type descriptors (if any) out of the fields. This ended up being much cleaner and simpler than trying to fake what's required to callField.contribute_to_class
with aCompositeType
as the class.