0

I have been testing a few django voting apps and found qhonuskan-votes. I have managed to install it and is works great. However, I also want it allow voting rights to non authenticated users which I am not able to do. Need help with this please.

Here is the link for its models.py, views.py and compact.py files of this app.

models

views

compact

Uma
  • 689
  • 2
  • 12
  • 35

1 Answers1

0

You could write a custom view which would look like def vote(request, model, object_id, value) from the external app, but without this piece of code in it:

if not request.user.is_authenticated():
    return HttpResponse(status=401)

Also make sure, that you map your custom view to the correct url instead of including app's urls:

url(r'^vote/$', view='custom_vote', name='qhonuskan_vote'))

This is not the best solution, because you are simply rewriting the code from the external app and I can't think of any proper way to override the default view in a way that would suit your needs. A better solution would be to use a different app, which allows votes by unauthenticated users (if a few lines of additional code are not a problem you can use this).

inejc
  • 550
  • 3
  • 14