Okay, so here's what I ended up going with: Rather than nested inline form sets, I made a formset for all of the encounters related to the map. Then, in my template when I iterate across all the nodes, I'm comparing all the encounters' nodes with the current node, and from there adding each encounter to the HTML. It's working pretty well so far.
Now to get the monsters' forms working... but I think I have a decent enough idea of how to do that now. -- Scott On Friday, May 2, 2014 11:50:10 AM UTC-6, Scott Harper wrote: > > I am using django as a tool for editing data for a game I'm working on; > but I have some pretty deeply-nested relationships, and I'm hitting some > problems getting forms to work properly. > > The setup: > I have a data structure for nodes in a map. Each map has many nodes; each > node has many encounters; each encounter has many individual monster fights. > > So the ownership I have set up is this: > Map > |-Node > ||-Encounter > |||-Fight > |||-Fight > ||-Encounter > |||-fight > |-Node > ||-Encounter > |||-Fight > |||-Fight > > ...and so forth. I have tried setting up nested inline formsets (there are > a couple examples online if you search them) and they worked fine to edit > each encounter on each node on the map, but as soon as I tried turning the > Encounter form into a nested inline formset (so a doubly-nested formset) I > can SEE the data when I render the HTML, but when I try to submit the form > data, I get a strange error in query.py when validating: line 115 (in > version 1.6.0); self._result_cache isn't None, but it IS empty, so > self._result_cache[k] is an invalid index. > > The question: > I don't even know that I'm going about this the best way. So if I'm > thinking about presenting my data all wrong, I welcome correction. If the > means seems appropriate but I must be missing some check or other to ensure > that I'm sending useable data. > > I want to believe that there's a better way to handle this than hacking > together two nested formsets, but I'm new enough at django and web > frameworks that I'm not sure what my alternatives are. > > I welcome any assistance that you folks can offer. Thank you. > > -- Scott > > (PS: I erroneously sent a partial message, for which I apologize.) > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6a63e607-14ef-4b4b-af5e-d2bfa3277a3a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.