On Thu, Jul 30, 2009 at 6:47 AM, rudy <[email protected]> wrote:

>
> Hello, everyone!
>
> I'd like to remove some object with many-to-many relationship from
> Django admin interface. Standard removing also removes all related
> objects and the list of removed objects displayed on confirmation
> page. But I don't need to remove related objects!
>
> Assume we have ContentTopic and ContentItem:
>
> 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.
>
> What is the best way to handle this?
>
>
> Alexey Rudy
>

Alexey,

I found this solution googling for "django one to many delete":
http://fragmentsofcode.wordpress.com/2009/03/06/django-gotcha-related-objects-deleted-by-default/

Best Regards,
Steve

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