On Jun 11, 8:43 am, Francis <lav.fran...@gmail.com> wrote:
> If a link an image in ProductPage and then delete the image later, the
> admin site will tell me that it would also delete the ProductPage. I
> tried it, and it got deleted.

I don't use the admin site that much, but this behavior strikes me as
wrong.

A work around is to perhaps use the pre_delete signal and clear the
relationships before delete is called:

def image_pre_delete(sender, instance, **kwargs):
   instance.productpage_set.clear()

signals.pre_delete.connect(image_pre_delete, sender=Image)


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