Let's say I have two models -  Article and Publication. Article has a
field

publications = models.ManyToManyField(Publication)

Let's say I present the user with a series of checkboxes representing
publications (much like the ModelMultipleChoiceField, but I am not
using ModelForms here) and getting back selected publications with

selectedPubs = map(int, request.POST.getlist('publications')) #getting
the selected primary keys -- integers

Then if I do

for x in selectedPubs :
    article1.publications.add(x)

This seems not a good enough solution as far as performance and
database interaction is concerned.

What is a better way to handle a situation like this?

Regards.

-- 
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.

Reply via email to