Django - 2 fields unique together

Posted by webvulture on Stack Overflow See other posts from Stack Overflow or by webvulture
Published on 2010-05-21T09:48:00Z Indexed on 2010/05/21 9:50 UTC
Read the original article Hit count: 220

Filed under:
|

Suppose, I want to record say poll choices by users everyday. In this case, i have a table named vote which has columns poll , choice and user-id . So how can i out the constraint (maybe in the django models or wherever possible) that poll and user-id both should not be the same for any entry but like the same user can vote for various different polls once and obviously various users can vote for the same poll. I hope I am clear.

© Stack Overflow or respective owner

Related posts about django

Related posts about django-models