Actually, I have added on to what I started with significantly, and what I ended up doing was emulating formsets with javascript on the page. When the page POSTs, I can get cleaned formset data from the request.
On Oct 2, 8:11 am, Felix Dreissig <f...@f30.me> wrote: > I'm not at all sure that this might help youm, so sorry if I write BS... > > Can't you just use form prefixes to kepp the form namespaces > seperated?http://docs.djangoproject.com/en/1.2/ref/forms/api/#prefixes-for-forms > > Regards, > Felix > > On 01.10.2010 22:22, ses1984 wrote: > > > > >http://docs.djangoproject.com/en/1.2/topics/db/models/#extra-fields-o... > > > I have two models with a many-to-many relationship through another > > table with extra fields. In this case, I have one extra field which > > represents the weight of the relationship. > > > I'm working on a view to edit the relationships between the two > > models. If we call the two models left-hand-side and right-hand-side, > > then the view is specific to one instance of the LHS, and the purpose > > of the view is to add relationships from that LHS-row to an arbitrary > > number of pre-existing RHS-rows. > > > Writing a view that, given an instance of the LHS, adds a single > > weighted relationship to an element on the RHS is pretty trivial. > > Writing view that adds an arbitrary number of relationships to the > > RHS is not that trivial, and that's what I would like to deliver to my > > users. > > > So far the view for a particular LHS-instance renders a page with a > > form to define a single additional relationship to the RHS. I have > > included a basic ajax function that GETs another form to the page. > > This is where the problem comes up: IDs of the form elements are going > > to overlap, and I won't be able to handle this when the form is > > POSTed. > > > I have thought of two options I could try to tackle this so far, both > > with javascript. The first would be to increment an index and send > > that through the ajax function to the view that returns a new form. > > The second would be to hook into the POST submission and munge the > > data before it's passed back to django to save model instances. > > > It seems to me that something like this, while not common, has to have > > been done before in web apps. I was wondering if there were some > > established patterns to do this sort of thing, and if I am on the > > right track. I have searched a few places including django snippets > > and packages to see if something like this has been done before, but I > > couldn't find anything. I'm not sure if I'm using the best search > > terms. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.