On Thu, Jul 30, 2009 at 04:47:05AM -0700, rudy wrote:
> class ContentTopic(models.Model):
>     name = models.CharField()
>     code = models.CharField()
> 
> class ContentItem(models.Model):
>     topic = models.ManyToManyField(ContentTopic, db_index=True,
> blank=True, related_name='content_item')
> 
> So, I'd like to remove ContentTopic instance using Django admin, but I
> don't need remove all related ContentItems. So, confirmation page
> should display only ContentTopic instance to remove.

My understanding (correct me if I am wrong) is it shouldn't be a problem with
many-to-many relationships.

When deleting a ContentTopic, Django will delete the entry from the mapping
table, and not touch ContentItem table. This is usually what you want - when
you delete the object you can't have the relationship anymore.

One-to-many relationships are a different story. You do have to be
careful here.
-- 
Brian May <[email protected]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to