﻿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
6760	Updating inherited models doest not work with customs defaults managers	Arnaud Rebts	nobody	"Here is the code that cause the bug:
{{{
#!python
class MovieManager(models.Manager):
    def get_query_set(self):
        """"""Do not return episodes""""""
        return super(MovieManager, self).get_query_set().filter(_class='Movie')

class Item(models.Model):
    _class = models.CharField(max_length=100)
    
class Movie(Item):
    objects = MovieManager()
    descript = models.CharField(max_length=255, blank=True)

class Episode(Movie):
    pass
}}}

Then, if I do the followings:
{{{
#!python
m = Movie(_class='Movie')
m.save()
m.save()
}}}
I get the following traceback with PostgreSQL :
{{{
#!python
Traceback (most recent call last):
  File ""/opt/local/lib/python2.5/site-packages/django/test/_doctest.py"", line 1267, in __run
    compileflags, 1) in test.globs
  File ""<doctest bugfix.update_not_working.models.Movie[2]>"", line 1, in <module>
    m.save()
  File ""/Users/kid/Code/Django/bugfix/../bugfix/update_not_working/models.py"", line 14, in save
    super(Item, self).save()
  File ""/opt/local/lib/python2.5/site-packages/django/db/models/base.py"", line 261, in save
    self.save_base()
  File ""/opt/local/lib/python2.5/site-packages/django/db/models/base.py"", line 301, in save_base
    manager.filter(pk=pk_val).update(**dict(values))
  File ""/opt/local/lib/python2.5/site-packages/django/db/models/query.py"", line 259, in update
    query.execute_sql(None)
  File ""/opt/local/lib/python2.5/site-packages/django/db/models/sql/subqueries.py"", line 112, in execute_sql
    super(UpdateQuery, self).execute_sql(result_type)
  File ""/opt/local/lib/python2.5/site-packages/django/db/models/sql/query.py"", line 1269, in execute_sql
    cursor.execute(sql, params)
ProgrammingError: subquery has too many columns
}}}
And with SQLite3:
{{{
#!python
Traceback (most recent call last):
  File ""/opt/local/lib/python2.5/site-packages/django/test/_doctest.py"", line 1267, in __run
    compileflags, 1) in test.globs
  File ""<doctest bugfix.update_not_working.models.Movie[2]>"", line 1, in <module>
    m.save()
  File ""/Users/kid/Code/Django/bugfix/../bugfix/update_not_working/models.py"", line 14, in save
    super(Item, self).save()
  File ""/opt/local/lib/python2.5/site-packages/django/db/models/base.py"", line 261, in save
    self.save_base()
  File ""/opt/local/lib/python2.5/site-packages/django/db/models/base.py"", line 301, in save_base
    manager.filter(pk=pk_val).update(**dict(values))
  File ""/opt/local/lib/python2.5/site-packages/django/db/models/query.py"", line 259, in update
    query.execute_sql(None)
  File ""/opt/local/lib/python2.5/site-packages/django/db/models/sql/subqueries.py"", line 112, in execute_sql
    super(UpdateQuery, self).execute_sql(result_type)
  File ""/opt/local/lib/python2.5/site-packages/django/db/models/sql/query.py"", line 1269, in execute_sql
    cursor.execute(sql, params)
  File ""/opt/local/lib/python2.5/site-packages/django/db/backends/sqlite3/base.py"", line 136, in execute
    return Database.Cursor.execute(self, query, params)
OperationalError: only a single result allowed for a SELECT that is part of an expression
}}}"		closed	Database layer (models, ORM)	queryset-refactor		fixed		arnaud.rebts@…	Unreviewed	0	0	0	0	0	0
