zzm88 / django-voting

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

feature request: send a signal that allows vetoing of a vote #16

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I want to prevent people from voting on an object that they themselves
created.  

Currently, the cleanest way is to listen for Vote's post_save signal and
delete the just-saved vote if it's illegal, but it's ugly to make two
round-trips to the DB when I'd prefer to make none at all.  I fiddled with
listening to pre_save, but it provides no way to stop the save-in-progress.

It would be really nice if django-voting fired off a "vote_will_be_saved"
signal that allowed receivers to veto the saving of the vote.  (The name
could be changed, I chose this to parallel newcomments'
comment_will_be_posted signal that does something similar.)

Attached patch accomplishes this.

Original issue reported on code.google.com by carl.j.meyer on 21 Sep 2008 at 2:53

Attachments: