On Aug 19, 10:09 pm, Ray <raymend...@gmail.com> wrote: > Hi, > thanks for the fast response! I'm trying to use the remove function > right now just like this sample code: > > # And from the other end>>> p2.article_set.remove(a5) > >>> p2.article_set.all() > [] > >>> a5.publications.all() > > [] > > fromhttp://www.djangoproject.com/documentation/models/many_to_many/ > > I'm doing "Group.objects.get(id=3).members.remove(member1)" > > and getting this error: 'ManyRelatedManager' object has no attribute > 'remove' > > I also did help to find out what methods ManyRelatedManager had, and > indeed it didn't have a 'remove' method, only: clear, create, > get_or_create, and get_query_set > > AND THEN, > > I tried the remove function with the queryset object, > "Group.objects.get(id=3).members.all().remove(member1)" > > and I got this error: 'QuerySet' object has no attribute 'remove' > > I'm at a loss as to how I'm supposed to update these relationships.... > > Ray
Well, that is weird. MayRelatedManager definitely *does* have an attribute 'remove'. With these basic models: class Category(models.Model): title = models.CharField(_('title'), max_length=100) class Post(models.Model): title = models.CharField(_('title'), max_length=200) categories = models.ManyToManyField(Category) the following works fine: >>> from blog.models import Post, Category >>> p=Post.objects.create(title='dan') >>> c=Category.objects.create(title='category') >>> p.categories.all() [] >>> p.categories.add(c) >>> p.categories.all() [<Category: category>] >>> p.categories.remove(c) >>> p.categories.all() [] So it works for me, I can't imagine what is happening with your setup. What version of Django are you using? -- DR. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 -~----------~----~----~----~------~----~------~--~---