I am trying to add generic relationships and one-to-one relationship is the source
Does anyone think how to do this? Or maybe there is another device for this type of thing:
./management.py dumpcmd user [: 10] & gt; Fixtures.json
You have several options on how to remove the problem. I'll focus on the capture-the-code approach, because it's been a while since I was walking with the Digengo Internal.
I've included the code related to the link below. Note that I have removed the irrelevant parts. Also keep in mind that the part you need to edit the part your case here needs a refactor.
Follow the following algorithm until you are satisfied. if
statement should be refactored on the basis of
- field (one or more) in different functions (s).
- Add inspection code until you find out that normal area relations.
- Add extraction code until normal relationships are followed.
-
Test. Def handle_models (auto, model, ** option): # SNIP handle option all = object if publicity: collection = set (for x in all (x__ class__, x.pk) )] Items: related to objects = [] objects: if DEBUG: print "% S [% s] to be added"% (model_name (x), x.pk) # For x follow the forward releases field x__ Class __._meta.fields + x.__ class __._meta.many_to_many: # ifinstance (f, foreigner) if you are here: new = getattr (x, f.name) # compiled object if new and not ( New .__ class__, new p.) Collected Or in Gaya: collected (add new (.__ class__, new .pk)) related to append (new) if isinstance (f, ManyToManyField): getattr (x, f.name). If not new and new (new .__ class__, new.pk) has been collected: collect.add ((new________, pk) related. Append (new) # snip objects = related all.extend (objects) ) # SNIP serialization
Comments
Post a Comment