Closed mrmachine closed 4 years ago
Hi there.
First of all, I recommend you to rename your "type" variable, since "type" is a Python primitive function: http://docs.python.org/2/library/functions.html#type.
I believe this may be a limitation of this look up field syntax. This is a very simple method. Probably for more complex use cases, like mix-in many variable values it may fail. If you can reproduce this with automated tests, it would be greate.
In the mean time, so I recommend you to use the F notation.
Thanks for reporting.
+1
@ckrybus @thinkt4nk @mrmachine
Finally it is fixed: https://github.com/paulocheque/django-dynamic-fixture/pull/106
Thanks a lot for the awesome catch!
I have
General
, with aOneToOneField
toPod
, andPod.type
can be['gallery', 'general', ...]
, andPod.broadcast
is aForeignKey
toBroadcast
.In my tests, first I create
broadcast
, then I want to createGeneral
(and other objects) and specify thatpod__broadcast=broadcast
andpod__type='general'
(or other types).But DDF wants to either use "gallery" (first option for
Pod.type
) or create newBroadcast
objects.If mixing
F()
with__
is not supported, it should raise an error, although having it work would be nice.However, it looks like there is definitely something wrong with
__
.