paulocheque / django-dynamic-fixture

A complete library to create dynamic model instances for testing purposes.
http://django-dynamic-fixture.readthedocs.io/
Other
390 stars 67 forks source link

Support custom fields that have multiple inheritance #40

Closed wesleykendall closed 10 years ago

wesleykendall commented 10 years ago

There are several fields that do multiple inheritance from a mixin and a Django field (like CharField). For example, the following fields:

JSONField from jsonfield EncryptedTextField from django-encrypted-fields

The original code in django-dynamic-fixture uses the first parent class when trying to figure out the proper type of field for a custom field. This pull request extends that functionality to check for the first parent field that subclasses Django's Field class. If there is no field that subclasses Field, it simply defaults to using the first parent class like before.

This fix has allowed us to easily work with the above fields without getting UnsupportedFields errors. Tests are included. Please let us know if there is anything we can do to help get this improvement merged and possibly published to pypi (we depend on it in our setup.py for other projects and have gotten around the issue thus far by providing values to the unsupported fields).

paulocheque commented 10 years ago

Amazing!

paulocheque commented 10 years ago

DDF 1.7.0 released with this PR!