paulocheque / django-dynamic-fixture

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

Support for GenericForeignKey #70

Open alexhayes opened 9 years ago

alexhayes commented 9 years ago

I'd like to propose better support for GenericForeignKeys.

I'd like to do the following;

owner = G(ModelWithDefaultValues)
G(ModelWithGenericForeignKey, owner=owner)

This would automatically set the owner_type and owner_id.

I've added a very basic failing test which could probably be expanded upon.

In terms of actual support in DDF I have not implemented this, however I'd be willing to attempt it if it's something the core devs believe should be a feature.

paulocheque commented 4 years ago

Hi @alexhayes . Sorry for the delay.

I suppose this could be interesting. Not sure yet how hard would be the implementation.

If you create a PR I would be glad to merge it.