flebel / django-tagging

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

Make Tag.objects.usage_for_model accept also a queryset as first parameter #100

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have a model MyModel which has a user field (ForeignKey to User model).
I'd like to apply the usage_for_model method to MyModel filtering out the
instances of MyModel for which the user is not authenticated (and viceversa).
I didn't find a way of doing it specifying a proper filters parameter
(probably I'm lacking knowledge and imagination...).
Do you have any suggestion on how to do it?
Maybe if usage for model could accept also a queryset rather than just a
model it could be possible somehow?

Many thanks
Francesco

Original issue reported on code.google.com by fd.calab...@gmail.com on 24 Feb 2008 at 10:02

GoogleCodeExporter commented 9 years ago
I solved the specific problem here reported but I still think it would be 
useful the
possibility to give a queryset rather than a model to usage_for_model.

Thanks again
Francesco

Original comment by fd.calab...@gmail.com on 3 Mar 2008 at 10:28

GoogleCodeExporter commented 9 years ago
Hi again,
sorry if I insist on this issue, I don't mean in any way to depreciate the 
value of
this awesome application. I just want to say that I came again across a 
situation
where it would have been quite useful to pass a queryset as parameter rather 
than
using the filters parameter. The obvious general case is when you have a custom
manager (say something like Blogs.objects.live()) and you would like to pass the
queryset returned by such manager rather than repeating in the filters 
parameter the
same logic you have in the managers. Moreover in some cases the django ORM is 
simply
not enough to handle all the cases.

Thanks again
Francesco

Original comment by fd.calab...@gmail.com on 8 Mar 2008 at 4:06

GoogleCodeExporter commented 9 years ago
Looking at teh code the object manager supports:

Tag.objects.usage_for_queryset()

Closing the request.

Original comment by doug.nap...@gmail.com on 12 Aug 2008 at 6:00