I'm trying to wrap my head around why a ForeignKey needs to be set
with null=True in order for its related model to call remove() on one
of its instances.

For example:

# models
class Company(models.Model):
    ...
class Location(models.Model):
    ...
    company= models.ForeignKey(Company)


# view
company = Company.objects.get(pk=1)
location = Location.objects.get(pk=1)
company.location_set.remove(location)  # raises 'RelatedManager'
object has no attribute 'remove'

Any help is appreciated as I can't find much documentation on this.



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