rohitjain-rj / django-tagging

Automatically exported from code.google.com/p/django-tagging
Other
0 stars 0 forks source link

Django Tagging fails in the last pre-alpha release of Django #233

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Django Tagging fails to apply extra joins using the the pre-alpha release
of Django, the 11967 rev in SVN.

The exceptions happens in:

./tagging/models.py
171:        extra_joins = ' '.join(queryset.query.get_from_clause()[0][1:])

Exception Value: Caught an exception while rendering: 'Query' object has no
attribute 'get_from_clause'

Original issue reported on code.google.com by marioces...@gmail.com on 22 Dec 2009 at 7:58

GoogleCodeExporter commented 9 years ago
Here is a traceback http://dpaste.com/136725/. Trying to render a tag cloud

Original comment by marioces...@gmail.com on 22 Dec 2009 at 8:07

GoogleCodeExporter commented 9 years ago
I made a patch for models.py to get django-tagging working with the django 
prealpha
release.

With the django prealpha realease, we have multidb support! Awesome ! That 
changes
the way to get raw sql queries. The correct usage in models.py lines 165 and 
166,
would be:

extra_joins = '
'.join(queryset.query.get_compiler(using='default').get_from_clause()[0][1:])
where, params = queryset.query.where.as_sql(None, None)

Original comment by marioces...@gmail.com on 22 Dec 2009 at 8:39

Attachments:

GoogleCodeExporter commented 9 years ago
This: 

where, params = queryset.query.where.as_sql(None, None)

breaks with: 

AttributeError at /

'NoneType' object has no attribute 'ops'

query.where.as_sql() should *not* be called with None, None as args.

Original comment by hanne....@gmail.com on 25 Dec 2009 at 7:02

GoogleCodeExporter commented 9 years ago
Updated patch. This works for me.

Disclaimer: I'm new to Django development, and I'm not in any way an expert on
Django's DB layer or ORM. If there's a better and/or less fragile way of fixing 
this
issue, feel free to comment or to update the patch yourself.

Original comment by jazepst...@gmail.com on 4 Jan 2010 at 11:54

Attachments:

GoogleCodeExporter commented 9 years ago
I haven't looked too deeply into this issue, but the latest patch works on 
*only* Django 1.2. I suspect this will fail 
on 1.0 and 1.1. 1.0 is less important as I'm okay making the next release 1.1 
the minimum requirement.

Original comment by bros...@gmail.com on 5 Jan 2010 at 6:10

GoogleCodeExporter commented 9 years ago

Original comment by bros...@gmail.com on 5 Jan 2010 at 6:11

GoogleCodeExporter commented 9 years ago
Here's a new patch that allows 1.1 and 1.2 compatibility together.

Original comment by jazepst...@gmail.com on 7 Jan 2010 at 11:31

Attachments:

GoogleCodeExporter commented 9 years ago
this patch works great

Original comment by justquick on 14 Jan 2010 at 4:33

GoogleCodeExporter commented 9 years ago
This patch does work a treat :-) Can anyone tell me when this will be added to 
the
SVN repository?

Cheers,
Rob

Original comment by robcharl...@gmail.com on 18 Jan 2010 at 12:17

GoogleCodeExporter commented 9 years ago
Fixed in r172

Original comment by bros...@gmail.com on 22 Jan 2010 at 8:39