﻿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
28210	`<orm_object>._state.adding` behaviour and model inheritance	Ivaylo Donchev	nobody	"Let's say we have the following models:
{{{
class User(models.Model):
    email = models.CharField(max_length=255, unique=True)
    password = models.CharField(max_length=32)

class Admin(User):
    pass

class ThirdPartyUser(User):
    pass
}}}

Steps to reproduce:
1. {{{ admin = Admin.objects.create(email='admin@admin.com') }}}


This will create an Admin instance and User instance, with `admin.user_ptr._state.adding == True`

2. {{{ ThirdPartyUser.objects.create(user_ptr = admin.user_ptr) }}}


This will raise the following error `{'email': ['User with this Email address already exists.'], 'id': ['User with this ID already exists.'] }`
When the admin is created, the `admin.user_ptr._state.adding` is True, but admin._state.adding is False (as it is already created). 
If we set {{{ admin.user_ptr._state.adding = False }}}, step 2 is passing without errors."	Bug	closed	Database layer (models, ORM)	1.11	Release blocker	fixed		Simon Charette	Ready for checkin	1	0	0	0	0	0
