#13640: add_filter in django/db/models/ sql/query.py causes exception when model
have 'evaluate' attribute
------------------------------------------+---------------------------------
 Reporter:  LukaszKorzybski               |       Owner:  nobody    
   Status:  new                           |   Milestone:            
Component:  Database layer (models, ORM)  |     Version:  1.2       
 Keywords:                                |       Stage:  Unreviewed
Has_patch:  0                             |  
------------------------------------------+---------------------------------
 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,

-- 
Ticket URL: <http://code.djangoproject.com/ticket/13640>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to