开发者

Django: how to prevent parent object to be deleted when deleting its child object

开发者 https://www.devze.com 2023-03-01 05:03 出处:网络
Class A(models.Model): name = models.CharField() Class B(A): extra_info = models.CharField() When I delete an B object, its parent obje开发者_如何学Pythonct A also gets deleted, how to solve this h
Class A(models.Model):
    name = models.CharField()

Class B(A):
    extra_info = models.CharField()

When I delete an B object, its parent obje开发者_如何学Pythonct A also gets deleted, how to solve this headache, thanks very much. I'm using Django 1.2.3


This isn't possible really in Django 1.2, but it is in Django 1.3, using on_delete.

0

精彩评论

暂无评论...
验证码 换一张
取 消