﻿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
6706	updating inherited models does not work	Dan Watson	nobody	"Saving initial instances of inherited models works as expected. However, when trying to update a field, a `FieldDoesNotExist` exception is thrown. For example, assume the following models:

{{{
class Location (models.Model):
    name = models.CharField( max_length=100 )

class PersonInfo (models.Model):
    first_name = models.CharField( max_length=100 )
    last_name = models.CharField( max_length=100 )

class Employer (PersonInfo):
    title = models.CharField( max_length=100 )
    office = models.ForeignKey( Location, related_name='employers' )
}}}

Then try the following:

{{{
office = Location( name='The Office' )
office.save()
boss = Employer( first_name='Dan', last_name='Watson', title='Boss', office=office )
boss.save()

# the following will break
boss.title = 'Some Other Title'
boss.save()
}}}

This is the traceback I get:

{{{
Traceback (most recent call last):
  File ""<console>"", line 1, in <module>
  File ""/home/dcwatson/python_packages/django/db/models/base.py"", line 268, in save
    self.save(raw, parent)
  File ""/home/dcwatson/python_packages/django/db/models/base.py"", line 286, in save
    manager.filter(pk=pk_val).update(**dict(values))
  File ""/home/dcwatson/python_packages/django/db/models/query.py"", line 258, in update
    query.add_update_values(kwargs)
  File ""/home/dcwatson/python_packages/django/db/models/sql/subqueries.py"", line 210, in add_update_values
    field, model, direct, m2m = self.model._meta.get_field_by_name(name)
  File ""/home/dcwatson/python_packages/django/db/models/options.py"", line 253, in get_field_by_name
    % (self.object_name, name))
FieldDoesNotExist: PersonInfo has no field named 'office'
}}}"		closed	Database layer (models, ORM)	queryset-refactor		fixed	model inheritance update	akaihol+django@…	Unreviewed	0	0	0	0	0	0
