This will be my first post here so I hope that everything will be correct.
I got some trouble with django, I try to make a little lottery game. For this game I have one app called bitcoinlottery and in that app 2 models. As for now they look like this:
from django.db import models
from django.utils import timezone
class Lottery(models.Model):
owner = models.ForeignKey('auth.User')
title = models.CharField(max_length=100)
slug = models.SlugField(max_length=110)
max_players = models.IntegerField()
total_players = models.CharField(default=0)
online = models.BooleanField(default=True)
create_date = models.DateTimeField(default=timezone.now)
class Ticket(models.Model):
owner = #this most be related to the user that buy the ticket
lottery_id = #this most be related to the id of the lottery
ticket_id = #a random number
Now I have two problems that I can't figure out.
The first one is how to create the number of tickets related on the Lottery max_players, the max_players will be a number of the maximum players/tickets available.
The second question is there a option to see all the available tickets in a list on the admin page of the lotteries?, and if yes, what is the way to do this.
Thanks for any help. Have a nice day.