#2351: MySQL syntax error on object.all().count(), when called from template
---------------------+------------------------------------------------------
   Reporter:  gumuz  |                Owner:  adrian          
     Status:  new    |            Component:  Database wrapper
    Version:         |           Resolution:                  
   Keywords:         |                Stage:  Unreviewed      
  Has_patch:  1      |           Needs_docs:  0               
Needs_tests:  0      |   Needs_better_patch:  0               
---------------------+------------------------------------------------------
Changes (by [EMAIL PROTECTED]):

  * has_patch:  0 => 1

Comment:

 I just ran into the same problem with Postgresql.
 
 The cause is a bug in QuerySet.__getitem__: it assumes that the parameter
 it gets is either a slice or an integer, but does not really check the
 latter.  When you put {{ somequeryset.qwe }} in your template and
 template.resolve_variable tries to  resolve it using a dictionary lookup,
 QuerySet.__getitem__ treats qwe like an integer index, which results in
 queries ending with "limit 1 offset qwe".
 
 The attached patch fixes the problem.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/2351#comment:4>
Django Code <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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to