League
- name
- List[User]
- List[Player]
- List[Season]
User
- name
- password
- League
Player
- name
- Scores (tournaments played)
Season
- name
- League
- start date (optional)
- end date (optional)
- List[Tournament]
- active
- visible
Tournament
- name
- start date (optional)
- end date (optional)
- League
- Optional[Season]
- List[Score]
- ScoringSystem
Score
- Player
- points
- Tournament
ScoringSystem
- name
- List[int] - points per place
TODO: History
- Score history (something)
Leaderboard
- select a season
- select a tournament (optional)
- show Players with their total Scores in the Season (and Tournament, optional)
- sort players by rank or by name
Setup environment
virtualenv virtualenv
source ./virtualenv/bin/activate
pip install -r requirements.txt
Prerequisites
- Docker
- Vagrant
psql
utility (on CentOS this is in thepostgresql
package)
Start the docker container using Vagrant
vagrant up
Connect to the container using psql
. Note this uses a dev password. Definitely don't use this in production.
PGPASSWORD=PokerScores123 psql -h localhost -U django pokerscores
NOTE All following steps assume you're in the pokerscores/
directory and have the virtualenv/
activated.
YOU DON"T NEED TO DO THIS STEP. This is how i setup the project initially.
django-admin startproject pokerscores
DATABASE_PASSWORD=PokerScores123 python manage.py startapp api
NOTE Only need to do this on the first run.
DATABASE_PASSWORD=PokerScores123 python manage.py migrate
DATABASE_PASSWORD=PokerScores123 python manage.py runserver
Test out the site by going to http://localhost:8000/api
Edit yoor model code
Creating migrations
DATABASE_PASSWORD=PokerScores123 python manage.py makemigrations api
Run the migrations, note the number will be created above and will be different that 0001
DATABASE_PASSWORD=PokerScores123 python manage.py sqlmigrate api 0001