Closed AndrewIngram closed 11 years ago
We'd also need to create the model instance with the specified default foreignkey if it doesn't already exsist.
Hi. I think this is a duplicated issue. Check my last comment in https://github.com/paulocheque/django-dynamic-fixture/issues/5
Regards
I just wrote another comment in #5. I filed that ticket then dropped the ball. I've now responded!
I have a model like this (heavily simplified):
If I try to create a city fixture using
G(City)
, it fails because it attempts to assign 2 as the value of currency, rather than the instance ofCurrency
with primary key 2I think the solution is alter
_process_field_with_default_fixture
to return the foreign key's model if there's a default value that's not an instance or callable.Admittedly, using defaults on relationship fields is a yucky, which we'll hopefully remove in the long run, but we'd like to be able to use DDF before then.