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()
[]

from http://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

On Aug 18, 7:03 pm, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Aug 18, 9:49 pm, Ray <raymend...@gmail.com> wrote:
>
> > I know in the backend, a manytomany relationship is essentially a join
> > table, but there seems to be no easy way to delete relationships from
> > it. The only remove option is made only for ForeignKey relationships.
> > Is there a workaround? Why would django design a relationship that you
> > can only add but not delete?
>
> The wording in the documentation 
> here:http://docs.djangoproject.com/en/dev/ref/models/relations/
> is potentially confusing. The top of the page clearly states that the
> methods are available both for foreignkeys and many-to-many
> relationships. However, remove() and clear() state that they are "only
> available on ForeignKeys where null=True". I believe this should just
> read "for FKs, these methods are only available where null=True" - in
> other words, they are available as you would expect for ManyToMany.
> --
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to