Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django guests vote only once poll

Tags:

python

django

I'm new to Django but am working on the tutorial on the Django website for creating a poll.

What is the best way to make it so guests (no registration / login) can only vote once on a poll?

  • IP (Don't want IP because people sharing a network can only vote once).
  • Cookie (User can delete the cookie but seems like the best approach).
  • Session (If the user closes the browser the session will change).

I'm guessing that Cookie would be the best approach but is there a better way for Django?

like image 818
Bot Avatar asked Jun 15 '12 23:06

Bot


2 Answers

There is one solution independent on the server framework you use:

Evercookie gives you virtually irrevokable cookies. Use them, if you want that level of data persistence.

Evercookie is a solution for storing data in cookies and various other places (such as memory used by Flash "cookies", HTML5's LocalStorage etc.). If any of these places is cleared, next visit on the site will populate it with data again. The only thing you need is the data stored in any of 13 places used by Evercookie and next visit populates it again to the other 12 places.

It is pretty hard to get rid of such cookies, so please take into account, whether your users actually agree to be tracked that way. Some of them certainly would not agree.

like image 191
Tadeck Avatar answered Sep 30 '22 16:09

Tadeck


If it is that important that people can only vote once, consider creating a basic registration / login system anyway. A guest can always use multiple computers to skew the voting while account registration at least allows you to track which e-mail addresses are being used to vote. It also takes a bit more effort to skew the voting that way. If it's important but not of life-saving importance then I would use the cookie approach for anonymous guests.

like image 24
Simeon Visser Avatar answered Sep 30 '22 18:09

Simeon Visser