Re: Help a newbie with his simple foreignkey problem?

2009-11-12 Thread Cody Django
Sorry - it should read: b = Book.objects.get(id=1) #new book request.user.get_profile().shelf1.add(b) #add book to shelf1 request.user.get_profile().shelf1.remove(b)#remove from shelf1 request.user.get_profile().shelf2.add(b) #add to shelf2 I

Re: Help a newbie with his simple foreignkey problem?

2009-11-12 Thread R. Gorman
> b = Book.objects.get(id=1)  #new book > request.user.get_profile().shelf1.add(b)  #add book to shelf1 > request.user.shelf1.remove(b)     #remove from shelf1 > request.user.shelf2.add(b)      #add to shelf2 Looks like you're trying to add the foreignkey to the User model instead of the

Help a newbie with his simple foreignkey problem?

2009-11-12 Thread Cody Django
Hi - I'm having a hard time wrapping my head around one-to-many relations. I'd like to be able to do this in a view: b = Book.objects.get(id=1) #new book request.user.get_profile().shelf1.add(b) #add book to shelf1 request.user.shelf1.remove(b) #remove from shelf1