﻿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
13640	add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute	LukaszKorzybski	Tobias McNulty	"I was migrating some django project recently from django 1.0.4 to 1.2.
In Django 1.2/1.1 I found that if model have 'evaluate' attribute then
one will get exception in admin edit page for that model if the page
contains inline forms with related models:
{{{
Exception Value:  'Shipper' object has no attribute 'prepare'
Exception Location:     .../django/db/models/sql/expressions.py in
__init__, line 12
}}}
It is caused by the fact that add_filter function in django/db/models/sql/query.py does such a check:
{{{
...
1005.  elif hasattr(value, 'evaluate'):
1006.      # If value is a query expression, evaluate it
1007.      value = SQLEvaluator(value, self) ...
1008.      having_clause = value.contains_aggregate
...
}}}
The problem is that ""value"" in this case is Shipper model which in
have ""evaluate"" method so it is recognized as query expression here.

Greetings, "	Bug	closed	Database layer (models, ORM)	dev	Normal	fixed		net147	Accepted	1	0	0	0	1	0
