danni / django-postgres-composite-types

Postgres composite types support for Django
BSD 3-Clause "New" or "Revised" License
51 stars 13 forks source link

Respect custom Field base classes on CompositeTypes #22

Closed gegenschall closed 5 years ago

gegenschall commented 5 years ago

Motivation for this PR: I needed to be able to provide custom to_python, get_prep_value methods on the generated field class. Currently this is not possible as CompositeTypeMeta.__new__ will only use BaseField as a base to generating a field class.

Changes in this PR: When a class named Field is supplied on a subclass of CompositeType we respect this and use it as a base class instead of the placeholder (CompositeType.Field) class.