On 5 Sty, 18:16, pjmorse <flashesofpa...@gmail.com> wrote: > > This is done by looping over the list of languages and saving a > NewsTrans in each language. The source language is marked as already > translated, the other two are not (that is, they still need > translating). > > The problem is that this is done with ns.save() (where ns is a > NewsTransForm with the submitted data), and what's actually happening > is that one NewsTrans is created, then it is updated twice, ending in > the third language. > > I thought I could fix this with ns.save(force_insert=True) but that > throws errors instead: "save() got an unexpected keyword argument > 'force_insert'". >
Take a look at this: http://docs.djangoproject.com/en/1.0/ref/models/instances/#how-django-knows-to-update-vs-insert - after first ns.save() 'ns' receives primary key (id), which in turn causes any subsequent ns.save() to UPDATE previously created row. I'm not sure why 'force_insert' is an unexpected argument, but it doesn't make sense anyway to use it. You can try ns.id = None; ns.save() instead. -- Tomasz Zielinski http://pyconsultant.eu
-- 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.