Hi all, I've been trawling through django code and i'm beginning to hit a brick wall on this one. I want to create a view to edit and create a bunch of objects. Edit those which exist and (optionally) add those that don't.
I have for the purposes of this discussion, four classes, Project, Group, ChecklistItem and Task. The idea is that every Group has a checlist (a bunch of ChecklistItems with a foreign key of their Group) which they must fulfill for every Project. The Task table is used to actually track which items on which checklist have been completed for which projecct. So the Task object has foreign keys for ChecklistItem and a Project and a boolean "completed" field. I want to be able to present a view for a specific group and a specific project that will show them and allow them to edit all of the items on their checklist for that project. In other words, for every ChecklistItem associated with that Group, if there is a Task object related to that ChecklistItem and the specified Project, populate the completed field appropriately - if there is not, provide a form with the checklistitem id and project id filled in and add the new item on submission. My problem stems from the fact that all of the django code i can see (version 0.9.5 - i can't upgrade to svn atm) provides nice shortcuts for editing a single object. The only code for editing multiple objects is for related objects edited inline. What i need is something *very* similar to this but not just for related objects - for *any* objects. I'm particularly confused by the index of fields get populated by django. So how it gets <relatedfieldname>.<index>.<fieldname> as the name of the input html field. The magic must be with the FormFieldCollection class, which takes an index as an input to __init__ but then appears simply to save it. I can't see how it's used then after that? When saving, the magic of de-mangling appears to be taken care of by the DotExpandedDict class which i can follow. I'm hoping if i can work out the magic of mangling the field names, i might be able to create a generic view for editing/creating multiple objects (preferably of any type) by using <modelname>.<index>.<fieldname> as the name of the input html field. I feel this would be useful for django developers. Any help or hints would be greatly appreciated and if anyone can explain the current "index" naming scheme creation in particular i'd be grateful. Please cc me in replies. Thanks, John --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

