I'm trying to call object_list in

django/views/generic/list_detail.py

with allow_empty=True

but if I use {{object_list.count}} in a template I get the following
error:


 (1064, "You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'count,1' at line 1")

the generated sql looks like:


SELECT DISTINCT
`db_tmpcompound`.`id`,`db_tmpcompound`.`name`,`db_tmpcompound`.`mol_weight`
FROM `db_tmpcompound`
WHERE ((`db_tmpcompound`.`db_nr` < 5))
ORDER BY `db_tmpcompound`.`db_nr` ASC LIMIT count,1


the next sql command gives the following result:


SELECT DISTINCT
`zb_tmpcompound`.`id`,`zb_tmpcompound`.`name`,`zb_tmpcompound`.`mol_weight`
FROM `zb_tmpcompound`
WHERE ((`zb_tmpcompound`.`zb_nr` < 5))
ORDER BY `zb_tmpcompound`.`zb_nr` ASC LIMIT 5

 ./manage.py dbshell < test.sql
id        name
mol_weight
599     2-(2-PYRIDYL)BENZIMIDAZOLE(PBI)  195.2240
598     2-(3-PYRIDYL)-1H-BENZIMIDAZOLE  195.2240
597     2-PHENYLIMIDAZOLE                       144.1760
596     3-phenyl-2H-1,2,4-triazole                   145.1600



so apparently the  .... ASC LIMIT count,1  is not correct.

I'm not sure if this is a bug or that I'm doing something wrong....

any help is appreciated

-abe


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

Reply via email to