cleverking / django-voting

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

vote_on_object generic-view should use a queryset #28

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Define a url pointing to vote_on_object
2. Use kwargs={'queryset': SomeModel.objects.all()}
3. Try to vote

What is the expected output? What do you see instead?
The view should vote and redirect to the sucess page but it gives the 
exception:

   TypeError: vote_on_object() got an unexpected keyword argument 
'queryset'

What version of the product are you using? On what operating system?
Trunk (r73) on Ubuntu Jaunty (9.04)

Please provide any additional information below.
Django's generic-views uses a queryset to lookup for objects, it's more 
flexible than using the default manager of a model.
I'm providing a patch to match this behaviour.

Original issue reported on code.google.com by rico.bl on 27 Aug 2009 at 8:50

Attachments:

GoogleCodeExporter commented 9 years ago
suppose you want to vote for different types of content such as photos, blog 
posts, etc. when you have to 
provide the model as an input for the vote_on_object() view function, you have 
to repeat some code within 
urls, templates and views, which doesn't feel DRY.

i would like to be able to either give the model name or the queryset as you 
have suggested to the 
vote_on_object(). this would allow generalizing voting logic even when the 
models in question are different. 

--
omat

Original comment by omat%gez...@gtempaccount.com on 12 May 2010 at 11:45