﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
12556	Django should not reset all parent model field values when saving child model with existing parent	Vasily Ivanov	nobody	"Here's my model (simplified for clarity):
{{{
class Property(models.Model):
	area = models.IntegerField()


class Restaurant(Property):
	num_meals = models.IntegerField()


class House(Property):
	num_rooms = models.IntegerField()


class RentedProperty(Property):
	rent  = models.IntegerField()
}}}

Now I want to create a Restaurant object that is rented property as well. I do this:

{{{
>> rp = RentedProperty.objects.create(area=100, rent=200)
>> rr = Restaurant.objects.create(num_meals=15, property_ptr=rp)
}}}
...and it fails on second line:
{{{
IntegrityError: null value in column ""area"" violates not-null constraint
}}}

However if I do this
{{{
>> rp = RentedProperty.objects.create(area=100, rent=200)
>> rr = Restaurant.objects.create(num_meals=15, area=100, property_ptr=rp)
}}}
it works just fine.

Why am I getting an Exception first time and why should I reset all parent model properties again to save Restaurant object with existing parent !RentedProperty?"		closed	Database layer (models, ORM)	1.1		invalid		bas@…	Unreviewed	0	0	0	0	0	0
