Opened 14 years ago
Closed 14 years ago
#15345 closed (invalid)
Model inheritance: wrong action of child_class_instance.delete()
Reported by: | truongsinh | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.2 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
#
#myapp.models
class Place(models.Model):
description = models.TextField()
def unicode(self):
return self.description
def reload(self):
self = Place.objects.get(id = self.id)
class Restaurant(Place):
name = models.TextField()
#console
from myapp.models import *
p1 = Place.object.create(description = "description1")
r1 = Restaurant.object.create(id = p1.id, description = p1.description, name =name)
r1.delete()
r1 = Restaurant.objects.get(id = r1.id)
# return expected error
p1 = Place.objects.get(id = p1.id)
# return unexpected error, possible because that row is also deleted
Change History (2)
comment:1 by , 14 years ago
Component: | Uncategorized → Database layer (models, ORM) |
---|
comment:2 by , 14 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |