ojengwa / django-tagging

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

django-tagging doesn't work with queryset-refactor #106

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
TagManager.usage_for_model uses "parse_lookup" which queryset-refactor removes 
(finally). 

The fix is to use the new power of qs-rf to construct that lookup properly; 
under the branch that 
"filters" argument should probably become a proper queryset; it can be 
introspected to find the 
query tree.

It should be possible to do this in a backwards-compatible manner by trapping 
the ImportError 
around parse_lookup and branching to a forward-looking implementation of 
parse_lookup.

Original issue reported on code.google.com by jacob.ka...@gmail.com on 17 Mar 2008 at 4:50

GoogleCodeExporter commented 9 years ago
BTW, I'm happy to work on this myself, though it won't happen until after the 
sprint.

Original comment by jacob.ka...@gmail.com on 17 Mar 2008 at 4:51

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This changes TagManager.usage_for_model to work on queryset-refactor.

It adds an optional queryset argument, but still supports the filters argument. 
 The filters, if specified, are added 
to the queryset prior to introspection.

Original comment by jpwa...@gmail.com on 17 Mar 2008 at 11:25

Attachments:

GoogleCodeExporter commented 9 years ago
The tests that separate pre and post qsrf to ensure that the new usage_for_model
works without parse_lookup.

Original comment by newmani...@gmail.com on 17 Mar 2008 at 11:26

Attachments:

GoogleCodeExporter commented 9 years ago
The earlier patch makes TagManager.usage_for_model compatible for 
queryset-refactor, but I thought the 
syntax was kind of ugly: specifying both model and queryset violates DRY.

This version fixes TagManager.usage_for_model on queryset-refactor, but 
maintains the original arguments.  
It also provides a new method, TagManager.usage_for_queryset, that takes a 
queryset argument and optional 
counts and min_counts arguments.  On queryset-refactor, 
TagManager.usage_for_model contructs a queryset 
from the specified model and filters and then lets 
TagManager.usage_for_queryset do the work.

TagManager.usage_for_queryset raises AttributeError on pre-queryset-refactor 
versions of Django.

Since there are now two methods performing basically the same query, I broke 
the custom SQL out into its 
own method, TagManager._get_usage, to avoid repeating it in both places.  That 
method can probably be 
consolidated into TagManager.usage_for_queryset once support for 
pre-queryset-refactor is dropped.

I've also included tests, based on the ones from newmaniese, that pass on trunk 
and queryset-refactor.  I 
think they're pretty complete; they include tests using exclude and complex 
filters.

Original comment by jpwa...@gmail.com on 19 Mar 2008 at 5:33

Attachments:

GoogleCodeExporter commented 9 years ago
So, qs-rf is in trunk now and this should be too.

Original comment by aenor.realm on 27 Apr 2008 at 9:50

GoogleCodeExporter commented 9 years ago
I agree, the model_or_queryset thing is pretty ugly - I'll try to make time 
this week
to get working on this now that qs-rf has been merged into trunk.

Thanks for the patches and investigation.

Original comment by jonathan.buchanan on 27 Apr 2008 at 10:05

GoogleCodeExporter commented 9 years ago
In the meantime, the last patch of jpwatts seems to work (at least it work for 
me).

Original comment by xphuture on 27 Apr 2008 at 2:40

GoogleCodeExporter commented 9 years ago
Ran into this bug today.  Would be nice to see this fixed soon.  Thanks for
everyone's hard work.

Original comment by clintec...@gmail.com on 27 Apr 2008 at 8:11

GoogleCodeExporter commented 9 years ago
How one use this patch? I really need tagging working here..

Original comment by italo.maia@gmail.com on 29 Apr 2008 at 5:49

GoogleCodeExporter commented 9 years ago
For this patch and any subversion patch, download this file in the trunk 
directory of
the project. Enter patch -p0 < patchfile.diff, it should then tell you what 
'hunks'
have been updated. Google patch subversion for more info. 

Original comment by newmani...@gmail.com on 29 Apr 2008 at 7:12

GoogleCodeExporter commented 9 years ago
Thanks again for the patches - jpwatts' last patch has now been included in 
revision 133.

Original comment by jonathan.buchanan on 30 Apr 2008 at 10:30

GoogleCodeExporter commented 9 years ago
thanks for the patch.. tagging is working again

Original comment by yash...@gmail.com on 25 May 2008 at 5:16