rich....@gmail.com
unread,Sep 29, 2009, 7:16:04 PM9/29/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
I have the following I'm trying to optimize.
Input (from the web) is
sids = "1,2,3,5" (a list of ids is posted, say they are article ids)
Now, to add them to a many to many, I'd like to just
try:
authors.articles.add(ids).
except:
I know the ids need to be ints, but tried a number of things to get
them into the proper format but all fail with one exception or another
ids = map(int, sids.split(','))
but i konw that: authors.articles.add(1,2,3,4) works....how do i get
"1,2,3,4" into 1,2,3,4
probably a simple python thing or something.
thanks
(disregard the need for validation above).