Hi,
I'm trying to design a model for a application allowing 2 people to bet with each other (I know, sounds stupid...). What I'm wondering about is how to connect the bet with users. The structure is like this
|-------------| |----------|
| Bet | | User |
| BetUser1 | |----------|
| BetUser2 |
| Winner |
| ... |
|-------------|
So we got 2 people that bet with each other (both are Users
from django auth system) and then, after one of them wins, there's a winner. Now all those 3 fields are of type User
, but:
- Should I make BetUser1 and BetUser2 separate fields, or design some many-to-two relationship here? (with many-to-two being a many-to-many and with some external way of ensuring no more then 2
Users
can be assigned to each bet? - winner can only be either user 1 or user 2, noone else of course. How should I create this field, yet another
ForeignKey(User)
, or some else?
Just looking for some fresh point of view, as it seems that in such stupid case I'm stuck with the django model system.