diff --git a/.env.example b/.env.example index 3818b043b..f840a16ef 100644 --- a/.env.example +++ b/.env.example @@ -29,9 +29,6 @@ storage_endpoint_url=https:// # Your email server (for example smtp.gmail.com) email_host= -# The email address you use for paypal -paypal_email= - # The login information for your email account email_host_user= email_host_password= @@ -54,6 +51,9 @@ site_name= site_server= #### Optional settings (only set these if you know what you're doing) +#enable_wagers= +#enable_store= +#paypal_email="" #user_verification= #esports_mode= #static_path= diff --git a/Jenkinsfile b/Jenkinsfile index 8977aea58..803d8223c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -57,4 +57,5 @@ pipeline { ''' } } -} \ No newline at end of file + +} diff --git a/changelog.md b/changelog.md index 1fbb15c38..f5282376c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,35 @@ Project Olly Changelog + +# 1.0.0 - YES WE'VE MADE IT +Started in August of 2017, after much delays of life and school +we're happy to call this a release build of project-olly. Thank you to al our contributors +that have made this goal possible! The support in all shapes and forms don't go unnoticed! + +Please note the substantial and large +changes made in this update may affect compatibility with previous versions databases +- Add SteamID64 and Discord profile fields +- Add basic stats models (will be built upon further in later updates) +- Added notification system for users +- Rework team invites and team roles entirely (from the backend) +- Fix multiple team list templates to work with new standards +- Improve staff panel teams templates +- Remove some hard coded links +- Add free agents to Leagues +- Allow staff to disable free agent registration for leagues within LeagueSettings +- Implement point system for LeagueMatches +- Basic team checkin process ahead of matches +- Multiple other staff panel league improvements +- Front end league template improvements (standings, and more) +- Complete rework of tournament brackets - no more size restrictions, much more efficient brackets! +- Switched to jenkins for project builds, no more travisci +- Implement map random picking for tournaments and league matches +- Shift to single template tournament brackets +- General code cleanup and improvement +- DoubleElimination tournaments soon! + +# 0.9.0 +- Implement leagues functionality + # 0.8.1 - News articles publish date now auto fills with last saved date when editing - Fix news post fields (fixes a possible 500 error when editing). closes #54 diff --git a/leagues/admin.py b/leagues/admin.py index 8c38f3f3d..91df4bbbb 100644 --- a/leagues/admin.py +++ b/leagues/admin.py @@ -1,3 +1,7 @@ from django.contrib import admin +from .models import League, LeagueDivision, LeagueTeam, LeagueSettings -# Register your models here. +admin.site.register(League) +admin.site.register(LeagueDivision) +admin.site.register(LeagueTeam) +admin.site.register(LeagueSettings) diff --git a/leagues/migrations/0001_initial.py b/leagues/migrations/0001_initial.py index 3fe93b481..6a8be0485 100644 --- a/leagues/migrations/0001_initial.py +++ b/leagues/migrations/0001_initial.py @@ -1,7 +1,6 @@ -# Generated by Django 2.2.12 on 2020-05-16 00:48 +# Generated by Django 2.2.15 on 2020-12-09 20:08 from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): @@ -9,12 +8,47 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('matches', '0022_auto_20200410_1506'), - ('teams', '0008_team_image'), - ('singletournaments', '0021_auto_20200420_0007'), ] operations = [ + migrations.CreateModel( + name='League', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(default='League Name', max_length=50)), + ('active', models.BooleanField(default=False)), + ('info', models.TextField(default='No information provided')), + ('created', models.DateTimeField(auto_now_add=True)), + ('updated', models.DateTimeField(auto_now=True)), + ('image', models.ImageField(blank=True, null=True, upload_to='league_images')), + ('teamformat', models.SmallIntegerField(choices=[(0, '1v1'), (1, '2v2'), (2, '3v3'), (3, '4v4'), (4, '5v5'), (5, '6v6')], default=1)), + ('bestof', models.SmallIntegerField(choices=[(0, 'Best of 1'), (1, 'Best of 3'), (2, 'Best of 5'), (3, 'Best of 7'), (4, 'Best of 9')], default=0)), + ('allow_register', models.BooleanField(default=False)), + ('open_register', models.DateTimeField()), + ('close_register', models.DateTimeField()), + ('start', models.DateTimeField()), + ('req_credits', models.PositiveSmallIntegerField(default=0)), + ('size', models.PositiveSmallIntegerField(default=8)), + ('disable_userreport', models.BooleanField(default=False)), + ('prize1', models.CharField(default='no prize specified', max_length=50)), + ('prize2', models.CharField(default='no prize specified', max_length=50)), + ('prize3', models.CharField(default='no prize specified', max_length=50)), + ], + ), + migrations.CreateModel( + name='LeagueDivision', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=50, null=True)), + ], + ), + migrations.CreateModel( + name='LeagueFreeAgent', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('description', models.TextField(default='Include information about Free Agent here')), + ], + ), migrations.CreateModel( name='LeagueSettings', fields=[ @@ -29,9 +63,17 @@ class Migration(migrations.Migration): ('allow_tie', models.BooleanField(default=False)), ('num_games', models.PositiveIntegerField(default=10)), ('auto_schedule', models.BooleanField(default=False)), - ('record_format', models.CharField(choices=[(1, 'W-L-OTL'), (2, 'W-L-T'), (3, 'W-L-OTW-OTL'), (4, 'W-L-OTW-OTL-OTT'), (5, 'W-L')], default='W-L-OTL', max_length=20)), - ('num_divisons', models.PositiveSmallIntegerField(default=2)), + ('auto_matchup', models.BooleanField(default=False)), + ('num_divisions', models.PositiveSmallIntegerField(default=2)), ('max_division_size', models.PositiveSmallIntegerField(default=5)), + ('require_xbl', models.BooleanField(default=False)), + ('require_psn', models.BooleanField(default=False)), + ('require_steam', models.BooleanField(default=False)), + ('require_epic', models.BooleanField(default=False)), + ('require_lol', models.BooleanField(default=False)), + ('require_battlenet', models.BooleanField(default=False)), + ('require_activision', models.BooleanField(default=False)), + ('allow_fa', models.BooleanField(default=False)), ], ), migrations.CreateModel( @@ -43,40 +85,7 @@ class Migration(migrations.Migration): ('ot_losses', models.PositiveSmallIntegerField(default=0)), ('ot_wins', models.PositiveSmallIntegerField(default=0)), ('ties', models.PositiveSmallIntegerField(default=0)), - ('team', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='league_team', to='teams.Team')), - ], - ), - migrations.CreateModel( - name='LeagueDivision', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=50, null=True)), - ('games', models.ManyToManyField(blank=True, to='matches.Match')), - ('teams', models.ManyToManyField(blank=True, to='leagues.LeagueTeam')), - ], - ), - migrations.CreateModel( - name='League', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(default='League Name', max_length=50)), - ('active', models.BooleanField(default=False)), - ('info', models.TextField(default='No information provided')), - ('created', models.DateTimeField(auto_now_add=True)), - ('updated', models.DateTimeField(auto_now=True)), - ('image', models.ImageField(blank=True, upload_to='league_images')), - ('teamformat', models.SmallIntegerField(choices=[(0, '1v1'), (1, '2v2'), (2, '3v3'), (3, '4v4'), (4, '5v5'), (5, '6v6')], default=1)), - ('bestof', models.SmallIntegerField(choices=[(0, 'Best of 1'), (1, 'Best of 3'), (2, 'Best of 5'), (3, 'Best of 7'), (4, 'Best of 9')], default=0)), - ('allow_register', models.BooleanField(default=False)), - ('open_register', models.DateTimeField()), - ('close_register', models.DateTimeField()), - ('start', models.DateTimeField()), - ('divisions', models.ManyToManyField(blank=True, to='leagues.LeagueDivision')), - ('game', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='league_game', to='matches.GameChoice')), - ('platform', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='league_platform', to='matches.PlatformChoice')), - ('ruleset', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='league_ruleset', to='singletournaments.SingleTournamentRuleset')), - ('settings', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='league_settings', to='leagues.LeagueSettings')), - ('sport', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='league_sport', to='matches.SportChoice')), + ('points', models.PositiveIntegerField(default=0)), ], ), ] diff --git a/leagues/migrations/0002_auto_20201209_1508.py b/leagues/migrations/0002_auto_20201209_1508.py new file mode 100644 index 000000000..86e566d05 --- /dev/null +++ b/leagues/migrations/0002_auto_20201209_1508.py @@ -0,0 +1,85 @@ +# Generated by Django 2.2.15 on 2020-12-09 20:08 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('leagues', '0001_initial'), + ('matches', '0002_auto_20201209_1508'), + ('teams', '0001_initial'), + ('profiles', '0001_initial'), + ('singletournaments', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='leagueteam', + name='team', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='league_team', to='teams.Team'), + ), + migrations.AddField( + model_name='leaguefreeagent', + name='user', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fa_profile', to='profiles.UserProfile'), + ), + migrations.AddField( + model_name='leaguedivision', + name='matches', + field=models.ManyToManyField(blank=True, to='matches.Match'), + ), + migrations.AddField( + model_name='leaguedivision', + name='teams', + field=models.ManyToManyField(blank=True, to='leagues.LeagueTeam'), + ), + migrations.AddField( + model_name='league', + name='divisions', + field=models.ManyToManyField(blank=True, to='leagues.LeagueDivision'), + ), + migrations.AddField( + model_name='league', + name='fa', + field=models.ManyToManyField(blank=True, related_name='league_fas', to='leagues.LeagueFreeAgent'), + ), + migrations.AddField( + model_name='league', + name='game', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='league_game', to='matches.GameChoice'), + ), + migrations.AddField( + model_name='league', + name='maps', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='league_maps', to='matches.MapPoolChoice'), + ), + migrations.AddField( + model_name='league', + name='platform', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='league_platform', to='matches.PlatformChoice'), + ), + migrations.AddField( + model_name='league', + name='ruleset', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='league_ruleset', to='singletournaments.SingleTournamentRuleset'), + ), + migrations.AddField( + model_name='league', + name='settings', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='league_settings', to='leagues.LeagueSettings'), + ), + migrations.AddField( + model_name='league', + name='sport', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='league_sport', to='matches.SportChoice'), + ), + migrations.AddField( + model_name='league', + name='teams', + field=models.ManyToManyField(blank=True, to='leagues.LeagueTeam'), + ), + ] diff --git a/leagues/migrations/0002_league_maps.py b/leagues/migrations/0002_league_maps.py deleted file mode 100644 index 5d0a053f5..000000000 --- a/leagues/migrations/0002_league_maps.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-16 00:55 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('matches', '0022_auto_20200410_1506'), - ('leagues', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='league', - name='maps', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='league_maps', to='matches.MapPoolChoice'), - ), - ] diff --git a/leagues/migrations/0003_auto_20200515_2139.py b/leagues/migrations/0003_auto_20200515_2139.py deleted file mode 100644 index 84e7b6b03..000000000 --- a/leagues/migrations/0003_auto_20200515_2139.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-16 01:39 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('leagues', '0002_league_maps'), - ] - - operations = [ - migrations.AddField( - model_name='league', - name='credits', - field=models.PositiveSmallIntegerField(default=0), - ), - migrations.AddField( - model_name='league', - name='size', - field=models.PositiveSmallIntegerField(default=8), - ), - ] diff --git a/leagues/migrations/0003_auto_20201209_1721.py b/leagues/migrations/0003_auto_20201209_1721.py new file mode 100644 index 000000000..0d6851855 --- /dev/null +++ b/leagues/migrations/0003_auto_20201209_1721.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.15 on 2020-12-09 22:21 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('leagues', '0002_auto_20201209_1508'), + ] + + operations = [ + migrations.AlterField( + model_name='league', + name='bestof', + field=models.SmallIntegerField(choices=[(1, 'Best of 1'), (2, 'Best of 2'), (3, 'Best of 3'), (4, 'Best of 4'), (5, 'Best of 5')], default=0), + ), + ] diff --git a/leagues/migrations/0004_auto_20200515_2205.py b/leagues/migrations/0004_auto_20200515_2205.py deleted file mode 100644 index a5e3b1e05..000000000 --- a/leagues/migrations/0004_auto_20200515_2205.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-16 02:05 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('leagues', '0003_auto_20200515_2139'), - ] - - operations = [ - migrations.RenameField( - model_name='leaguesettings', - old_name='num_divisons', - new_name='num_divisions', - ), - ] diff --git a/leagues/migrations/0004_auto_20201209_1729.py b/leagues/migrations/0004_auto_20201209_1729.py new file mode 100644 index 000000000..c11d79bb6 --- /dev/null +++ b/leagues/migrations/0004_auto_20201209_1729.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.15 on 2020-12-09 22:29 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('leagues', '0003_auto_20201209_1721'), + ] + + operations = [ + migrations.AlterField( + model_name='league', + name='bestof', + field=models.SmallIntegerField(choices=[(1, 'Best of 1'), (2, 'Best of 2'), (3, 'Best of 3'), (4, 'Best of 4'), (5, 'Best of 5')], default=1), + ), + ] diff --git a/leagues/migrations/0005_remove_leaguesettings_record_format.py b/leagues/migrations/0005_remove_leaguesettings_record_format.py deleted file mode 100644 index a5596d88f..000000000 --- a/leagues/migrations/0005_remove_leaguesettings_record_format.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-16 02:23 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('leagues', '0004_auto_20200515_2205'), - ] - - operations = [ - migrations.RemoveField( - model_name='leaguesettings', - name='record_format', - ), - ] diff --git a/leagues/migrations/0006_league_disable_userreport.py b/leagues/migrations/0006_league_disable_userreport.py deleted file mode 100644 index a12fd4a35..000000000 --- a/leagues/migrations/0006_league_disable_userreport.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-16 22:08 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('leagues', '0005_remove_leaguesettings_record_format'), - ] - - operations = [ - migrations.AddField( - model_name='league', - name='disable_userreport', - field=models.BooleanField(default=False), - ), - ] diff --git a/leagues/migrations/0007_auto_20200516_1809.py b/leagues/migrations/0007_auto_20200516_1809.py deleted file mode 100644 index 9d9b10c8b..000000000 --- a/leagues/migrations/0007_auto_20200516_1809.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-16 22:09 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('leagues', '0006_league_disable_userreport'), - ] - - operations = [ - migrations.RenameField( - model_name='league', - old_name='credits', - new_name='req_credits', - ), - ] diff --git a/leagues/migrations/0008_auto_20200516_1814.py b/leagues/migrations/0008_auto_20200516_1814.py deleted file mode 100644 index 64b19fe05..000000000 --- a/leagues/migrations/0008_auto_20200516_1814.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-16 22:14 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('leagues', '0007_auto_20200516_1809'), - ] - - operations = [ - migrations.AlterField( - model_name='league', - name='sport', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='league_sport', to='matches.SportChoice'), - ), - ] diff --git a/leagues/migrations/0009_auto_20200516_1815.py b/leagues/migrations/0009_auto_20200516_1815.py deleted file mode 100644 index 707d93cbb..000000000 --- a/leagues/migrations/0009_auto_20200516_1815.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-16 22:15 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('leagues', '0008_auto_20200516_1814'), - ] - - operations = [ - migrations.AlterField( - model_name='league', - name='divisions', - field=models.ManyToManyField(blank=True, null=True, to='leagues.LeagueDivision'), - ), - ] diff --git a/leagues/migrations/0010_auto_20200516_1817.py b/leagues/migrations/0010_auto_20200516_1817.py deleted file mode 100644 index f345b55ba..000000000 --- a/leagues/migrations/0010_auto_20200516_1817.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-16 22:17 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('leagues', '0009_auto_20200516_1815'), - ] - - operations = [ - migrations.AlterField( - model_name='league', - name='divisions', - field=models.ManyToManyField(blank=True, to='leagues.LeagueDivision'), - ), - migrations.AlterField( - model_name='league', - name='game', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='league_game', to='matches.GameChoice'), - ), - migrations.AlterField( - model_name='league', - name='platform', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='league_platform', to='matches.PlatformChoice'), - ), - ] diff --git a/leagues/migrations/0011_auto_20200516_1817.py b/leagues/migrations/0011_auto_20200516_1817.py deleted file mode 100644 index fab41006a..000000000 --- a/leagues/migrations/0011_auto_20200516_1817.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-16 22:17 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('leagues', '0010_auto_20200516_1817'), - ] - - operations = [ - migrations.AlterField( - model_name='league', - name='image', - field=models.ImageField(blank=True, null=True, upload_to='league_images'), - ), - ] diff --git a/leagues/migrations/0012_auto_20200516_1818.py b/leagues/migrations/0012_auto_20200516_1818.py deleted file mode 100644 index 3c998c9ba..000000000 --- a/leagues/migrations/0012_auto_20200516_1818.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-16 22:18 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('leagues', '0011_auto_20200516_1817'), - ] - - operations = [ - migrations.AlterField( - model_name='league', - name='maps', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='league_maps', to='matches.MapPoolChoice'), - ), - ] diff --git a/leagues/migrations/0013_leaguesettings_auto_matchup.py b/leagues/migrations/0013_leaguesettings_auto_matchup.py deleted file mode 100644 index f645200f2..000000000 --- a/leagues/migrations/0013_leaguesettings_auto_matchup.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-26 17:01 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('leagues', '0012_auto_20200516_1818'), - ] - - operations = [ - migrations.AddField( - model_name='leaguesettings', - name='auto_matchup', - field=models.BooleanField(default=False), - ), - ] diff --git a/leagues/migrations/0014_auto_20200530_1901.py b/leagues/migrations/0014_auto_20200530_1901.py deleted file mode 100644 index f189390d4..000000000 --- a/leagues/migrations/0014_auto_20200530_1901.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-30 23:01 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('leagues', '0013_leaguesettings_auto_matchup'), - ] - - operations = [ - migrations.RenameField( - model_name='leaguedivision', - old_name='games', - new_name='matches', - ), - ] diff --git a/leagues/migrations/0015_auto_20200726_1705.py b/leagues/migrations/0015_auto_20200726_1705.py deleted file mode 100644 index ed99033cb..000000000 --- a/leagues/migrations/0015_auto_20200726_1705.py +++ /dev/null @@ -1,28 +0,0 @@ -# Generated by Django 2.2.14 on 2020-07-26 21:05 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('leagues', '0014_auto_20200530_1901'), - ] - - operations = [ - migrations.AddField( - model_name='league', - name='prize1', - field=models.CharField(default='no prize specified', max_length=50), - ), - migrations.AddField( - model_name='league', - name='prize2', - field=models.CharField(default='no prize specified', max_length=50), - ), - migrations.AddField( - model_name='league', - name='prize3', - field=models.CharField(default='no prize specified', max_length=50), - ), - ] diff --git a/leagues/migrations/0016_league_teams.py b/leagues/migrations/0016_league_teams.py deleted file mode 100644 index 78948d236..000000000 --- a/leagues/migrations/0016_league_teams.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.14 on 2020-07-26 21:27 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('leagues', '0015_auto_20200726_1705'), - ] - - operations = [ - migrations.AddField( - model_name='league', - name='teams', - field=models.ManyToManyField(blank=True, to='leagues.LeagueTeam'), - ), - ] diff --git a/leagues/models.py b/leagues/models.py index ae44f42f2..1afec0703 100644 --- a/leagues/models.py +++ b/leagues/models.py @@ -3,6 +3,7 @@ from matches.models import Match, GameChoice, PlatformChoice, MapPoolChoice, MapChoice, SportChoice from matches.settings import TEAMFORMAT_CHOICES, MAPFORMAT_CHOICES from singletournaments.models import SingleTournamentRuleset +from profiles.models import UserProfile # a way to create default values for a field over multiple seasons @@ -40,6 +41,16 @@ class LeagueSettings(models.Model): num_divisions = models.PositiveSmallIntegerField(default=2) # max amount of teams to allow into a division max_division_size = models.PositiveSmallIntegerField(default=5) + # is xbl required to join? + require_xbl = models.BooleanField(default=False) + require_psn = models.BooleanField(default=False) + require_steam = models.BooleanField(default=False) + require_epic = models.BooleanField(default=False) + require_lol = models.BooleanField(default=False) + require_battlenet = models.BooleanField(default=False) + require_activision = models.BooleanField(default=False) + # whether or not to allow users to register as a free agent to the league + allow_fa = models.BooleanField(default=False) def __str__(self): return self.name @@ -52,6 +63,7 @@ class LeagueTeam(models.Model): ot_losses = models.PositiveSmallIntegerField(default=0) ot_wins = models.PositiveSmallIntegerField(default=0) ties = models.PositiveSmallIntegerField(default=0) + points = models.PositiveIntegerField(default=0) def __str__(self): return self.team.name @@ -72,6 +84,11 @@ def __str__(self): return self.name +class LeagueFreeAgent(models.Model): + user = models.ForeignKey(UserProfile, related_name='fa_profile', on_delete=models.CASCADE) + description = models.TextField(default="Include information about Free Agent here") + + class League(models.Model): name = models.CharField(default="League Name", max_length=50) settings = models.ForeignKey(LeagueSettings, related_name="league_settings", on_delete=models.PROTECT) @@ -90,7 +107,7 @@ class League(models.Model): teamformat = models.SmallIntegerField(choices=TEAMFORMAT_CHOICES, default=1) # by default its a best of 1. Not sure if we need this here. Finals might be best of 3, etc in # the future possibly. TBD. For now this will work though. - bestof = models.SmallIntegerField(choices=MAPFORMAT_CHOICES, default=0) + bestof = models.SmallIntegerField(choices=MAPFORMAT_CHOICES, default=1) # manually open registration even if outside registration window allow_register = models.BooleanField(default=False) # when does registration open, and when does it close? specified when created in staff panel @@ -108,5 +125,6 @@ class League(models.Model): prize2 = models.CharField(default='no prize specified', max_length=50) prize3 = models.CharField(default='no prize specified', max_length=50) teams = models.ManyToManyField(LeagueTeam, blank=True) + fa = models.ManyToManyField(LeagueFreeAgent, related_name="league_fas", blank=True) diff --git a/leagues/views.py b/leagues/views.py index 2aa46b8da..58f6f5083 100644 --- a/leagues/views.py +++ b/leagues/views.py @@ -1,7 +1,8 @@ from django.shortcuts import render, get_object_or_404 from django.contrib import messages from django.shortcuts import redirect -from .models import League, LeagueDivision, LeagueSettings +from .models import League, LeagueDivision +from profiles.models import UserProfile def list_leagues(request): @@ -10,25 +11,67 @@ def list_leagues(request): def detail_league(request, pk): - league = get_object_or_404(League) + league = get_object_or_404(League, pk=pk) teams = league.teams.all() + if league.divisions is None: + # there are no divisions + pass + elif len(league.divisions.all()) == 1: + # there is only one division show the matches in the one page + division = league.divisions.first() + matches = division.matches + return render(request, 'leagues/league_division.html', + {'league': league, 'matches': matches, 'division': division}) return render(request, 'leagues/league_detail.html', {'league': league, 'teams': teams}) def join_league(request, pk): - pass + league = get_object_or_404(League, pk=pk) + # TODO - create join league form and send to template + userprofile = UserProfile.objects.get(user__username=request.user.username) + # TODO - create join league form and send to template + if request.method == 'GET': + # send the form + pass + elif request.method == 'POST': + # try and get them to join the league + # make sure enough players exist on the team + if league.req_credits > 0: + # there is a credit fee, check the user has enough credits + if userprofile.credits >= league.req_credits: + # they do have enough credits + userprofile.credits = userprofile.credits - league.req_credits + userprofile.save() + else: + messages.error(request, "You do not have enough credits to enter your team in this league") + return redirect('leagues:detail', pk=pk) + # now lets check that the team has enough players + + return render(request, 'leagues/league_join.html', {'league': league}) def leave_league(request, pk): + # find out which team wants to leave pass def detail_league_teams(request, pk): - pass + # show all the teams in the league + # get all divisions first + league = League.objects.get(pk=pk) + if league.divisions.count() == 0: + messages.error(request, "There are no divisions or teams in this league yet, check back later") + return redirect('league:list') + teams = [] + for x in league.divisions.all(): + for y in x.teams.all(): + teams.append(y) + + return render(request, "leagues/league_teams.html", {'teams': teams, 'league': league}) def list_league_divisions(request, pk): - league = get_object_or_404(League) + league = get_object_or_404(League, pk=pk) if league.divisions.count() == 0: messages.warning(request, "There are no divisions for this league yet") return redirect('league:detail', pk) @@ -39,11 +82,15 @@ def list_league_divisions(request, pk): def detail_league_division(request, pk, divid): - league = get_object_or_404(League) + league = get_object_or_404(League, pk=pk) division = LeagueDivision.objects.get(pk=divid) matches = division.matches.all() - return render(request, 'leagues/league_division.html', {'league': league, 'division': division, 'matches': matches}) + teams = division.teams.all().order_by('-points') + return render(request, 'leagues/league_division.html', {'league': league, 'division': division, 'matches': matches, + 'teams': teams}) def detail_league_rules(request, pk): - pass + league = get_object_or_404(League, pk=pk) + rules = league.ruleset + return render(request, 'singletournaments/ruleset_detail.html', {'ruleset': rules}) diff --git a/matches/admin.py b/matches/admin.py index 75c93ce5e..415f0c4b4 100644 --- a/matches/admin.py +++ b/matches/admin.py @@ -1,5 +1,8 @@ from django.contrib import admin -from .models import Match +from .models import Match, MapChoice, MapPoolChoice, MatchCheckIn admin.site.register(Match) +admin.site.register(MapChoice) +admin.site.register(MapPoolChoice) +admin.site.register(MatchCheckIn) diff --git a/matches/forms.py b/matches/forms.py index 43c44b3e5..bf3ebddaa 100644 --- a/matches/forms.py +++ b/matches/forms.py @@ -1,5 +1,4 @@ from django import forms - from matches.models import MatchReport, MatchDispute, Match from teams.models import Team @@ -30,10 +29,24 @@ class Meta: class DisputeCreateForm(forms.ModelForm): - # teamproof_1 = forms.URLField() - # teamproof_2 = forms.URLField() - # teamproof_3 = forms.URLField() class Meta: model = MatchDispute fields = ['teamproof_1', 'teamproof_2', 'teamproof_3'] + + +class TeamCheckInFormGet(forms.Form): + class Meta: + model = Team + + players = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple) + + def __init__(self, team): + mylist = team.players.all().values_list("pk", "username") | team.captain.all().values_list("pk", "username") + super().__init__() + self.fields['players'].choices = mylist + # self.fields['players'].queryset = mylist + + +class TeamCheckInFormPost(forms.Form): + players = forms.Form() diff --git a/matches/migrations/0001_initial.py b/matches/migrations/0001_initial.py index 652ace4ee..271ee924f 100644 --- a/matches/migrations/0001_initial.py +++ b/matches/migrations/0001_initial.py @@ -1,66 +1,73 @@ -# Generated by Django 2.0.5 on 2018-07-03 23:45 +# Generated by Django 2.2.15 on 2020-12-09 20:08 -from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): + initial = True dependencies = [ - ('teams', '0001_initial'), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ + migrations.CreateModel( + name='GameChoice', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(default='unknown', max_length=255)), + ('image', models.ImageField(blank=True, upload_to='game_images')), + ], + ), + migrations.CreateModel( + name='MapChoice', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(default='default_map', max_length=255)), + ('created', models.DateTimeField(auto_now_add=True)), + ('updated', models.DateTimeField(auto_now=True)), + ('map_num', models.IntegerField(blank=True, default=0, null=True)), + ], + ), + migrations.CreateModel( + name='MapPoolChoice', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(default='default map pool', max_length=255)), + ('description', models.CharField(default='No map pool description', max_length=255)), + ('created', models.DateTimeField(auto_now_add=True)), + ('updated', models.DateTimeField(auto_now=True)), + ], + ), migrations.CreateModel( name='Match', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('type', models.CharField(blank=True, max_length=20, null=True)), ('matchnum', models.SmallIntegerField(default=0)), - ('game', models.SmallIntegerField( - choices=[(0, 'No Game Set'), (1, 'Call of Duty Black Ops 3'), (2, 'Call of Duty WWII'), - (3, 'Fortnite'), (4, 'Destiny 2'), (5, 'Counter-Strike: Global Offensive'), - (6, 'Player Unknowns Battlegrounds'), (7, 'Rainbow Six Siege'), (8, 'Overwatch'), - (9, 'League of Legends'), (10, 'Hearthstone'), (11, 'World of Warcraft'), (12, 'Smite'), - (13, 'Rocket League'), (14, 'Battlefield 1')], default=0)), - ('platform', models.SmallIntegerField( - choices=[(0, 'Playstation 4'), (1, 'Xbox One'), (2, 'PC'), (3, 'Mobile'), (4, 'Nintendo Switch'), - (5, 'Playstation 3'), (6, 'Xbox 360')], default=0)), ('reported', models.BooleanField(default=False)), ('completed', models.BooleanField(default=False)), - ('bestof', models.SmallIntegerField( - choices=[(0, 'Best of 1'), (1, 'Best of 3'), (2, 'Best of 5'), (3, 'Best of 7'), (4, 'Best of 9')], - default=0)), - ('teamformat', models.SmallIntegerField( - choices=[(0, '1v1'), (1, '2v2'), (2, '3v3'), (3, '4v4'), (4, '5v5'), (5, '6v6')], default=1)), + ('bestof', models.SmallIntegerField(choices=[(0, 'Best of 1'), (1, 'Best of 3'), (2, 'Best of 5'), (3, 'Best of 7'), (4, 'Best of 9')], default=0)), + ('teamformat', models.SmallIntegerField(choices=[(0, '1v1'), (1, '2v2'), (2, '3v3'), (3, '4v4'), (4, '5v5'), (5, '6v6')], default=1)), ('team1reported', models.BooleanField(default=False)), ('team2reported', models.BooleanField(default=False)), + ('info', models.TextField(default='Match Info: ')), ('disputed', models.BooleanField(default=False)), - ('awayteam', - models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='awayteam', - to='teams.Team')), - ('hometeam', - models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='hometeam', - to='teams.Team')), - ('loser', - models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='loser', - to='teams.Team')), - ('team1reportedwinner', - models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, - related_name='team1reportedwinner', to='teams.Team')), - ('team2reportedwinner', - models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, - related_name='team2reportedwinner', to='teams.Team')), - ('winner', - models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='champions', - to='teams.Team')), + ('bye_1', models.BooleanField(default=False)), + ('bye_2', models.BooleanField(default=False)), + ('disable_userreport', models.BooleanField(default=True)), ], options={ 'verbose_name_plural': 'matches', }, ), + migrations.CreateModel( + name='MatchCheckIn', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ], + ), migrations.CreateModel( name='MatchDispute', fields=[ @@ -70,20 +77,105 @@ class Migration(migrations.Migration): ('teamproof_1', models.URLField()), ('teamproof_2', models.URLField(blank=True)), ('teamproof_3', models.URLField(blank=True)), - ('match', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='disputedMatch', - to='matches.Match')), - ('team1', - models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='team1', to='teams.Team')), - ('team1origreporter', - models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='team1OriginalReporter', - to=settings.AUTH_USER_MODEL)), - ('team2', - models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='team2', to='teams.Team')), - ('team2origreporter', - models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='team2OriginalReporter', - to=settings.AUTH_USER_MODEL)), - ('teamreporter', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, - related_name='team1Disputer', to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='MatchStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('matchid', models.PositiveIntegerField(default=0)), + ('map', models.CharField(default='unknown', max_length=255)), + ('team1', models.CharField(default='unknown', max_length=255)), + ('team2', models.CharField(default='unknown', max_length=255)), + ], + ), + migrations.CreateModel( + name='PlatformChoice', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(default='unknown', max_length=255)), + ('image', models.ImageField(blank=True, null=True, upload_to='platform_images')), + ], + ), + migrations.CreateModel( + name='SportChoice', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(default='unknown sports', max_length=255)), + ], + ), + migrations.CreateModel( + name='StatsPlayer', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('rating', models.DecimalField(decimal_places=3, default=0, max_digits=6)), + ('kills', models.IntegerField(default=0)), + ('assists', models.IntegerField(default=0)), + ('deaths', models.IntegerField(default=0)), + ('killround', models.DecimalField(decimal_places=3, default=0, max_digits=6)), + ('adr', models.IntegerField(default=0)), + ('ud', models.IntegerField(default=0)), + ('ef', models.IntegerField(default=0)), + ('f_assists', models.IntegerField(default=0)), + ('hs', models.IntegerField(default=0)), + ('kast', models.IntegerField(default=0)), + ('awp_k', models.IntegerField(default=0)), + ('twok', models.IntegerField(default=0)), + ('threek', models.IntegerField(default=0)), + ('fourk', models.IntegerField(default=0)), + ('fivek', models.IntegerField(default=0)), + ('one_v_one', models.IntegerField(default=0)), + ('one_v_two', models.IntegerField(default=0)), + ('one_v_three', models.IntegerField(default=0)), + ('one_v_four', models.IntegerField(default=0)), + ('one_v_five', models.IntegerField(default=0)), + ('f_kills', models.IntegerField(default=0)), + ('f_deaths', models.IntegerField(default=0)), + ('entries', models.IntegerField(default=0)), + ('trades', models.IntegerField(default=0)), + ('rounds', models.IntegerField(default=0)), + ('rf', models.IntegerField(default=0)), + ('ra', models.IntegerField(default=0)), + ('damage', models.IntegerField(default=0)), + ], + ), + migrations.CreateModel( + name='TeamMatchStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('rounds_won', models.PositiveSmallIntegerField(default=0)), + ('rounds_lost', models.PositiveSmallIntegerField(default=0)), + ('total_kills', models.PositiveSmallIntegerField(default=0)), + ('total_deaths', models.PositiveSmallIntegerField(default=0)), + ('avg_rating', models.DecimalField(decimal_places=3, default=0, max_digits=6)), + ('avg_killround', models.DecimalField(decimal_places=3, default=0, max_digits=6)), + ('avg_adr', models.IntegerField(default=0)), + ('avg_ud', models.IntegerField(default=0)), + ('avg_ef', models.IntegerField(default=0)), + ('total_rating', models.DecimalField(decimal_places=3, default=0, max_digits=6)), + ('total_killround', models.DecimalField(decimal_places=3, default=0, max_digits=6)), + ('total_adr', models.IntegerField(default=0)), + ('total_ud', models.IntegerField(default=0)), + ('total_ef', models.IntegerField(default=0)), + ('avg_hs', models.IntegerField(default=0)), + ('avg_kast', models.IntegerField(default=0)), + ('awp_k', models.IntegerField(default=0)), + ('twok', models.IntegerField(default=0)), + ('threek', models.IntegerField(default=0)), + ('fourk', models.IntegerField(default=0)), + ('fivek', models.IntegerField(default=0)), + ('one_v_one', models.IntegerField(default=0)), + ('one_v_two', models.IntegerField(default=0)), + ('one_v_three', models.IntegerField(default=0)), + ('one_v_four', models.IntegerField(default=0)), + ('one_v_five', models.IntegerField(default=0)), + ('f_kills', models.IntegerField(default=0)), + ('f_deaths', models.IntegerField(default=0)), + ('entries', models.IntegerField(default=0)), + ('trades', models.IntegerField(default=0)), + ('rounds', models.IntegerField(default=0)), + ('avg_damage', models.IntegerField(default=0)), + ('total_damage', models.IntegerField(default=0)), ], ), migrations.CreateModel( @@ -92,17 +184,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('created', models.DateTimeField(auto_now_add=True)), ('proof', models.CharField(default='no text inserted', max_length=300)), - ('match', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='matchreporting', - to='matches.Match')), - ('reported_winner', - models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='winnerreporting', - to='teams.Team')), - ('reporting_team', - models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='teamreporting', - to='teams.Team')), - ('reporting_user', - models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='userreporting', - to=settings.AUTH_USER_MODEL)), + ('match', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='matchreporting', to='matches.Match')), ], ), ] diff --git a/matches/migrations/0002_auto_20181012_0254.py b/matches/migrations/0002_auto_20181012_0254.py deleted file mode 100644 index 08af2873f..000000000 --- a/matches/migrations/0002_auto_20181012_0254.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.0.8 on 2018-10-12 02:54 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('matches', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='match', - name='game', - field=models.SmallIntegerField( - choices=[(0, 'No Game Set'), (1, 'Call of Duty Black Ops 3'), (2, 'Call of Duty WWII'), (3, 'Fortnite'), - (4, 'Destiny 2'), (5, 'Counter-Strike: Global Offensive'), - (6, 'Player Unknowns Battlegrounds'), (7, 'Rainbow Six Siege'), (8, 'Overwatch'), - (9, 'League of Legends'), (10, 'Hearthstone'), (11, 'World of Warcraft'), (12, 'Smite'), - (13, 'Rocket League'), (14, 'Battlefield 1'), (15, 'Black Ops 4')], default=0), - ), - ] diff --git a/matches/migrations/0015_auto_20190713_1335.py b/matches/migrations/0002_auto_20201209_1508.py similarity index 55% rename from matches/migrations/0015_auto_20190713_1335.py rename to matches/migrations/0002_auto_20201209_1508.py index 9489e54fa..1d20a707c 100644 --- a/matches/migrations/0015_auto_20190713_1335.py +++ b/matches/migrations/0002_auto_20201209_1508.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.2 on 2019-07-13 17:35 +# Generated by Django 2.2.15 on 2020-12-09 20:08 from django.conf import settings from django.db import migrations, models @@ -7,94 +7,148 @@ class Migration(migrations.Migration): + initial = True + dependencies = [ - ('matches', '0014_merge_20190605_1915'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('teams', '0001_initial'), + ('matches', '0001_initial'), ] operations = [ - migrations.AlterField( + migrations.AddField( + model_name='matchreport', + name='reported_winner', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='winnerreporting', to='teams.Team'), + ), + migrations.AddField( + model_name='matchreport', + name='reporting_team', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='teamreporting', to='teams.Team'), + ), + migrations.AddField( + model_name='matchreport', + name='reporting_user', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='userreporting', to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='matchdispute', + name='match', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='disputedMatch', to='matches.Match'), + ), + migrations.AddField( + model_name='matchdispute', + name='team1', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='team1', to='teams.Team'), + ), + migrations.AddField( + model_name='matchdispute', + name='team1origreporter', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='team1OriginalReporter', to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='matchdispute', + name='team2', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='team2', to='teams.Team'), + ), + migrations.AddField( + model_name='matchdispute', + name='team2origreporter', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='team2OriginalReporter', to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='matchdispute', + name='teamreporter', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='team1Disputer', to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='matchcheckin', + name='match', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='match_checkin', to='matches.Match'), + ), + migrations.AddField( + model_name='matchcheckin', + name='players', + field=models.ManyToManyField(to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='matchcheckin', + name='reporter', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='checkin_user', to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='matchcheckin', + name='team', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='checking_in_team', to='teams.Team'), + ), + migrations.AddField( model_name='match', name='awayteam', field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='awayteam', to='teams.Team'), ), - migrations.AlterField( + migrations.AddField( model_name='match', name='game', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='GameChoice', to='matches.GameChoice'), + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='GameChoice', to='matches.GameChoice'), ), - migrations.AlterField( + migrations.AddField( model_name='match', name='hometeam', field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='hometeam', to='teams.Team'), ), - migrations.AlterField( + migrations.AddField( model_name='match', name='loser', field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='loser', to='teams.Team'), ), - migrations.AlterField( + migrations.AddField( model_name='match', name='map', field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='match_map', to='matches.MapChoice'), ), - migrations.AlterField( + migrations.AddField( + model_name='match', + name='maps', + field=models.ManyToManyField(to='matches.MapPoolChoice'), + ), + migrations.AddField( model_name='match', name='platform', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='PlatformChoice', to='matches.PlatformChoice'), + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='PlatformChoice', to='matches.PlatformChoice'), + ), + migrations.AddField( + model_name='match', + name='sport', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='SportChoice', to='matches.SportChoice'), ), - migrations.AlterField( + migrations.AddField( model_name='match', name='team1reportedwinner', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='team1reportedwinner', to='teams.Team'), ), - migrations.AlterField( + migrations.AddField( model_name='match', name='team2reportedwinner', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='team2reportedwinner', to='teams.Team'), ), - migrations.AlterField( + migrations.AddField( model_name='match', name='winner', field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='champions', to='teams.Team'), ), - migrations.AlterField( - model_name='matchdispute', - name='team1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='team1', to='teams.Team'), - ), - migrations.AlterField( - model_name='matchdispute', - name='team1origreporter', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='team1OriginalReporter', to=settings.AUTH_USER_MODEL), - ), - migrations.AlterField( - model_name='matchdispute', - name='team2', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='team2', to='teams.Team'), - ), - migrations.AlterField( - model_name='matchdispute', - name='team2origreporter', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='team2OriginalReporter', to=settings.AUTH_USER_MODEL), - ), - migrations.AlterField( - model_name='matchdispute', - name='teamreporter', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='team1Disputer', to=settings.AUTH_USER_MODEL), - ), - migrations.AlterField( - model_name='matchreport', - name='reported_winner', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='winnerreporting', to='teams.Team'), + migrations.AddField( + model_name='mappoolchoice', + name='game', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='map_pool_for', to='matches.GameChoice'), ), - migrations.AlterField( - model_name='matchreport', - name='reporting_team', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='teamreporting', to='teams.Team'), + migrations.AddField( + model_name='mappoolchoice', + name='maps', + field=models.ManyToManyField(blank=True, to='matches.MapChoice'), ), - migrations.AlterField( - model_name='matchreport', - name='reporting_user', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='userreporting', to=settings.AUTH_USER_MODEL), + migrations.AddField( + model_name='mapchoice', + name='game', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='map_for', to='matches.GameChoice'), ), ] diff --git a/matches/migrations/0003_auto_20201209_1705.py b/matches/migrations/0003_auto_20201209_1705.py new file mode 100644 index 000000000..207029f5d --- /dev/null +++ b/matches/migrations/0003_auto_20201209_1705.py @@ -0,0 +1,28 @@ +# Generated by Django 2.2.15 on 2020-12-09 22:05 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('matches', '0002_auto_20201209_1508'), + ] + + operations = [ + migrations.RemoveField( + model_name='match', + name='map', + ), + migrations.AddField( + model_name='match', + name='map_pool', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='mappoolchoice', to='matches.MapPoolChoice'), + ), + migrations.AlterField( + model_name='match', + name='maps', + field=models.ManyToManyField(to='matches.MapChoice'), + ), + ] diff --git a/matches/migrations/0003_match_info.py b/matches/migrations/0003_match_info.py deleted file mode 100644 index e4884e5aa..000000000 --- a/matches/migrations/0003_match_info.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 2.0.5 on 2018-10-13 20:09 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('matches', '0002_auto_20181012_0254'), - ] - - operations = [ - migrations.AddField( - model_name='match', - name='info', - field=models.TextField(default='Match Info: '), - ), - ] diff --git a/matches/migrations/0004_auto_20181018_2054.py b/matches/migrations/0004_auto_20181018_2054.py deleted file mode 100644 index 137e1108a..000000000 --- a/matches/migrations/0004_auto_20181018_2054.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.0.4 on 2018-10-19 00:54 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('matches', '0003_match_info'), - ] - - operations = [ - migrations.AlterField( - model_name='match', - name='platform', - field=models.SmallIntegerField( - choices=[(0, 'Playstation 4'), (1, 'Xbox One'), (2, 'PC'), (3, 'Mobile'), (4, 'Nintendo Switch'), - (5, 'Playstation 3'), (6, 'Xbox 360'), (7, 'All Consoles'), (8, 'All Platforms')], default=0), - ), - ] diff --git a/matches/migrations/0004_auto_20201209_1721.py b/matches/migrations/0004_auto_20201209_1721.py new file mode 100644 index 000000000..cd96c04f8 --- /dev/null +++ b/matches/migrations/0004_auto_20201209_1721.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.15 on 2020-12-09 22:21 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('matches', '0003_auto_20201209_1705'), + ] + + operations = [ + migrations.AlterField( + model_name='match', + name='bestof', + field=models.SmallIntegerField(choices=[(1, 'Best of 1'), (2, 'Best of 2'), (3, 'Best of 3'), (4, 'Best of 4'), (5, 'Best of 5')], default=1), + ), + ] diff --git a/matches/migrations/0005_auto_20181029_0402.py b/matches/migrations/0005_auto_20181029_0402.py deleted file mode 100644 index 9999ba1b3..000000000 --- a/matches/migrations/0005_auto_20181029_0402.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.0.8 on 2018-10-29 04:02 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('matches', '0004_auto_20181018_2054'), - ] - - operations = [ - migrations.AddField( - model_name='match', - name='bye_1', - field=models.BooleanField(default=False), - ), - migrations.AddField( - model_name='match', - name='bye_2', - field=models.BooleanField(default=False), - ), - ] diff --git a/matches/migrations/0005_auto_20201215_1425.py b/matches/migrations/0005_auto_20201215_1425.py new file mode 100644 index 000000000..6e5bde17a --- /dev/null +++ b/matches/migrations/0005_auto_20201215_1425.py @@ -0,0 +1,34 @@ +# Generated by Django 2.2.15 on 2020-12-15 19:25 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('matches', '0004_auto_20201209_1721'), + ] + + operations = [ + migrations.AlterField( + model_name='match', + name='loser', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='loser', to='teams.Team'), + ), + migrations.AlterField( + model_name='match', + name='maps', + field=models.ManyToManyField(blank=True, to='matches.MapChoice'), + ), + migrations.AlterField( + model_name='match', + name='sport', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='SportChoice', to='matches.SportChoice'), + ), + migrations.AlterField( + model_name='match', + name='winner', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='champions', to='teams.Team'), + ), + ] diff --git a/matches/migrations/0006_gamechoice_platformchoice.py b/matches/migrations/0006_gamechoice_platformchoice.py deleted file mode 100644 index 3061950b2..000000000 --- a/matches/migrations/0006_gamechoice_platformchoice.py +++ /dev/null @@ -1,28 +0,0 @@ -# Generated by Django 2.0.7 on 2019-01-12 02:16 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('matches', '0005_auto_20181029_0402'), - ] - - operations = [ - migrations.CreateModel( - name='GameChoice', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(default='unknown', max_length=255)), - ('image', models.ImageField(blank=True, upload_to='game_images')), - ], - ), - migrations.CreateModel( - name='PlatformChoice', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(default='unknown', max_length=255)), - ('image', models.ImageField(blank=True, null=True, upload_to='platform_images')), - ], - ), - ] diff --git a/wagers/migrations/0002_wagerrequest_expired.py b/matches/migrations/0006_match_config_generated.py similarity index 58% rename from wagers/migrations/0002_wagerrequest_expired.py rename to matches/migrations/0006_match_config_generated.py index 7e55aef9a..6788a28b0 100644 --- a/wagers/migrations/0002_wagerrequest_expired.py +++ b/matches/migrations/0006_match_config_generated.py @@ -1,4 +1,4 @@ -# Generated by Django 2.1.5 on 2019-04-04 19:59 +# Generated by Django 2.2.15 on 2020-12-31 22:31 from django.db import migrations, models @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('wagers', '0001_initial'), + ('matches', '0005_auto_20201215_1425'), ] operations = [ migrations.AddField( - model_name='wagerrequest', - name='expired', + model_name='match', + name='config_generated', field=models.BooleanField(default=False), ), ] diff --git a/matches/migrations/0007_auto_20190112_1514.py b/matches/migrations/0007_auto_20190112_1514.py deleted file mode 100644 index 6d033335d..000000000 --- a/matches/migrations/0007_auto_20190112_1514.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 2.0.4 on 2019-01-12 20:14 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - dependencies = [ - ('matches', '0006_gamechoice_platformchoice'), - ] - - operations = [ - migrations.AlterField( - model_name='match', - name='game', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='GameChoice', - to='matches.GameChoice'), - ), - migrations.AlterField( - model_name='match', - name='platform', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='PlatformChoice', - to='matches.PlatformChoice'), - ), - ] diff --git a/matches/migrations/0007_auto_20210101_1444.py b/matches/migrations/0007_auto_20210101_1444.py new file mode 100644 index 000000000..f013159ff --- /dev/null +++ b/matches/migrations/0007_auto_20210101_1444.py @@ -0,0 +1,23 @@ +# Generated by Django 2.2.15 on 2021-01-01 19:44 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('matches', '0006_match_config_generated'), + ] + + operations = [ + migrations.AddField( + model_name='match', + name='datetime', + field=models.DateTimeField(blank=True, null=True), + ), + migrations.AddField( + model_name='match', + name='server', + field=models.CharField(blank=True, max_length=255, null=True), + ), + ] diff --git a/matches/migrations/0008_auto_20190315_2152.py b/matches/migrations/0008_auto_20190315_2152.py deleted file mode 100644 index e6c49bee1..000000000 --- a/matches/migrations/0008_auto_20190315_2152.py +++ /dev/null @@ -1,42 +0,0 @@ -# Generated by Django 2.1.7 on 2019-03-16 01:52 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('matches', '0007_auto_20190112_1514'), - ] - - operations = [ - migrations.CreateModel( - name='MapChoice', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(default='default_map', max_length=255)), - ('created', models.DateTimeField(auto_now_add=True)), - ('updated', models.DateTimeField(auto_now=True)), - ('map_num', models.IntegerField(default=0)), - ('game', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='map_for', to='matches.GameChoice')), - ], - ), - migrations.CreateModel( - name='MapPoolChoice', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(default='default map pool', max_length=255)), - ('description', models.CharField(default='No map pool description', max_length=255)), - ('created', models.DateTimeField(auto_now_add=True)), - ('updated', models.DateTimeField(auto_now=True)), - ('game', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='map_pool_for', to='matches.GameChoice')), - ('maps', models.ManyToManyField(to='matches.MapChoice')), - ], - ), - migrations.AddField( - model_name='match', - name='map', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='match_map', to='matches.MapChoice'), - ), - ] diff --git a/matches/migrations/0008_match_type.py b/matches/migrations/0008_match_type.py deleted file mode 100644 index ce86353d6..000000000 --- a/matches/migrations/0008_match_type.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.1.7 on 2019-05-24 00:59 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('matches', '0007_auto_20190112_1514'), - ] - - operations = [ - migrations.AddField( - model_name='match', - name='type', - field=models.CharField(blank=True, max_length=20, null=True), - ), - ] diff --git a/matches/migrations/0009_auto_20190328_1906.py b/matches/migrations/0009_auto_20190328_1906.py deleted file mode 100644 index 1c420c898..000000000 --- a/matches/migrations/0009_auto_20190328_1906.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.1.5 on 2019-03-28 23:06 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('matches', '0008_auto_20190315_2152'), - ] - - operations = [ - migrations.AlterField( - model_name='mappoolchoice', - name='maps', - field=models.ManyToManyField(blank=True, null=True, to='matches.MapChoice'), - ), - ] diff --git a/matches/migrations/0010_auto_20190328_2021.py b/matches/migrations/0010_auto_20190328_2021.py deleted file mode 100644 index f32a00455..000000000 --- a/matches/migrations/0010_auto_20190328_2021.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.1.5 on 2019-03-29 00:21 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('matches', '0009_auto_20190328_1906'), - ] - - operations = [ - migrations.AlterField( - model_name='mapchoice', - name='map_num', - field=models.IntegerField(blank=True, default=0, null=True), - ), - ] diff --git a/matches/migrations/0011_auto_20190328_2021.py b/matches/migrations/0011_auto_20190328_2021.py deleted file mode 100644 index 13b983b0d..000000000 --- a/matches/migrations/0011_auto_20190328_2021.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.1.5 on 2019-03-29 00:21 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('matches', '0010_auto_20190328_2021'), - ] - - operations = [ - migrations.AlterField( - model_name='mapchoice', - name='map_num', - field=models.IntegerField(blank=True, default=0), - ), - ] diff --git a/matches/migrations/0012_auto_20190328_2021.py b/matches/migrations/0012_auto_20190328_2021.py deleted file mode 100644 index 3ea3d6ebb..000000000 --- a/matches/migrations/0012_auto_20190328_2021.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.1.5 on 2019-03-29 00:21 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('matches', '0011_auto_20190328_2021'), - ] - - operations = [ - migrations.AlterField( - model_name='mapchoice', - name='map_num', - field=models.IntegerField(blank=True, default=0, null=True), - ), - ] diff --git a/matches/migrations/0013_auto_20190328_2022.py b/matches/migrations/0013_auto_20190328_2022.py deleted file mode 100644 index 83b62c522..000000000 --- a/matches/migrations/0013_auto_20190328_2022.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.1.5 on 2019-03-29 00:22 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('matches', '0012_auto_20190328_2021'), - ] - - operations = [ - migrations.AlterField( - model_name='mappoolchoice', - name='maps', - field=models.ManyToManyField(blank=True, to='matches.MapChoice'), - ), - ] diff --git a/matches/migrations/0014_merge_20190605_1915.py b/matches/migrations/0014_merge_20190605_1915.py deleted file mode 100644 index c645b07f6..000000000 --- a/matches/migrations/0014_merge_20190605_1915.py +++ /dev/null @@ -1,14 +0,0 @@ -# Generated by Django 2.2.2 on 2019-06-05 23:15 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('matches', '0013_auto_20190328_2022'), - ('matches', '0008_match_type'), - ] - - operations = [ - ] diff --git a/matches/migrations/0016_auto_20200108_1654.py b/matches/migrations/0016_auto_20200108_1654.py deleted file mode 100644 index 9c07a0e1c..000000000 --- a/matches/migrations/0016_auto_20200108_1654.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.2 on 2020-01-08 21:54 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('matches', '0015_auto_20190713_1335'), - ] - - operations = [ - migrations.AlterField( - model_name='match', - name='bestof', - field=models.SmallIntegerField(choices=[(0, 'Best of 1'), (1, 'Best of 3'), (2, 'Best of 5'), (3, 'Best of 7'), (4, 'Best of 9')], default=0, null=True), - ), - ] diff --git a/matches/migrations/0017_sportchoice.py b/matches/migrations/0017_sportchoice.py deleted file mode 100644 index f1f24e766..000000000 --- a/matches/migrations/0017_sportchoice.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 2.2.2 on 2020-01-08 22:42 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('matches', '0016_auto_20200108_1654'), - ] - - operations = [ - migrations.CreateModel( - name='SportChoice', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(default='unknown sports', max_length=255)), - ], - ), - ] diff --git a/matches/migrations/0018_match_disable_userreports.py b/matches/migrations/0018_match_disable_userreports.py deleted file mode 100644 index fb237a37a..000000000 --- a/matches/migrations/0018_match_disable_userreports.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.7 on 2020-01-15 16:17 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('matches', '0017_sportchoice'), - ] - - operations = [ - migrations.AddField( - model_name='match', - name='disable_userreports', - field=models.BooleanField(default=True), - ), - ] diff --git a/matches/migrations/0019_auto_20200115_1127.py b/matches/migrations/0019_auto_20200115_1127.py deleted file mode 100644 index f7714d954..000000000 --- a/matches/migrations/0019_auto_20200115_1127.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 2.2.7 on 2020-01-15 16:27 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('matches', '0018_match_disable_userreports'), - ] - - operations = [ - migrations.AddField( - model_name='match', - name='sports', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='SportChoice', to='matches.SportChoice'), - ), - migrations.AlterField( - model_name='match', - name='game', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='GameChoice', to='matches.GameChoice'), - ), - migrations.AlterField( - model_name='match', - name='platform', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='PlatformChoice', to='matches.PlatformChoice'), - ), - ] diff --git a/matches/migrations/0020_auto_20200115_1132.py b/matches/migrations/0020_auto_20200115_1132.py deleted file mode 100644 index 955652041..000000000 --- a/matches/migrations/0020_auto_20200115_1132.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.7 on 2020-01-15 16:32 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('matches', '0019_auto_20200115_1127'), - ] - - operations = [ - migrations.RenameField( - model_name='match', - old_name='sports', - new_name='sport', - ), - ] diff --git a/matches/migrations/0021_auto_20200115_1133.py b/matches/migrations/0021_auto_20200115_1133.py deleted file mode 100644 index adfcd1a67..000000000 --- a/matches/migrations/0021_auto_20200115_1133.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.7 on 2020-01-15 16:33 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('matches', '0020_auto_20200115_1132'), - ] - - operations = [ - migrations.RenameField( - model_name='match', - old_name='disable_userreports', - new_name='disable_userreport', - ), - ] diff --git a/matches/migrations/0022_auto_20200410_1506.py b/matches/migrations/0022_auto_20200410_1506.py deleted file mode 100644 index 14dffb599..000000000 --- a/matches/migrations/0022_auto_20200410_1506.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.3 on 2020-04-10 19:06 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('matches', '0021_auto_20200115_1133'), - ] - - operations = [ - migrations.AlterField( - model_name='match', - name='bestof', - field=models.SmallIntegerField(choices=[(0, 'Best of 1'), (1, 'Best of 3'), (2, 'Best of 5'), (3, 'Best of 7'), (4, 'Best of 9')], default=0), - ), - ] diff --git a/matches/models.py b/matches/models.py index 87dfacd29..0dfc2958b 100644 --- a/matches/models.py +++ b/matches/models.py @@ -1,13 +1,92 @@ from django.contrib.auth.models import User from django.db import models - from matches.settings import TEAMFORMAT_CHOICES, MAPFORMAT_CHOICES from teams.models import Team +class StatsPlayer(models.Model): + rating = models.DecimalField(max_digits=6, decimal_places=3, default=0) + kills = models.IntegerField(default=0) + assists = models.IntegerField(default=0) + deaths = models.IntegerField(default=0) + killround = models.DecimalField(max_digits=6, decimal_places=3, default=0) + adr = models.IntegerField(default=0) + ud = models.IntegerField(default=0) + ef = models.IntegerField(default=0) + f_assists = models.IntegerField(default=0) + hs = models.IntegerField(default=0) + kast = models.IntegerField(default=0) + awp_k = models.IntegerField(default=0) + twok = models.IntegerField(default=0) + threek = models.IntegerField(default=0) + fourk = models.IntegerField(default=0) + fivek = models.IntegerField(default=0) + one_v_one = models.IntegerField(default=0) + one_v_two = models.IntegerField(default=0) + one_v_three = models.IntegerField(default=0) + one_v_four = models.IntegerField(default=0) + one_v_five = models.IntegerField(default=0) + f_kills = models.IntegerField(default=0) + f_deaths = models.IntegerField(default=0) + entries = models.IntegerField(default=0) + trades = models.IntegerField(default=0) + rounds = models.IntegerField(default=0) + rf = models.IntegerField(default=0) + ra = models.IntegerField(default=0) + damage = models.IntegerField(default=0) + + +class TeamMatchStats(models.Model): + rounds_won = models.PositiveSmallIntegerField(default=0) + rounds_lost = models.PositiveSmallIntegerField(default=0) + total_kills = models.PositiveSmallIntegerField(default=0) + total_deaths = models.PositiveSmallIntegerField(default=0) + avg_rating = models.DecimalField(max_digits=6, decimal_places=3, default=0) + avg_killround = models.DecimalField(max_digits=6, decimal_places=3, default=0) + avg_adr = models.IntegerField(default=0) + avg_ud = models.IntegerField(default=0) + avg_ef = models.IntegerField(default=0) + total_rating = models.DecimalField(max_digits=6, decimal_places=3, default=0) + total_killround = models.DecimalField(max_digits=6, decimal_places=3, default=0) + total_adr = models.IntegerField(default=0) + total_ud = models.IntegerField(default=0) + total_ef = models.IntegerField(default=0) + # ??? f_assists = models.IntegerField(default=0) + avg_hs = models.IntegerField(default=0) + avg_kast = models.IntegerField(default=0) + awp_k = models.IntegerField(default=0) + twok = models.IntegerField(default=0) + threek = models.IntegerField(default=0) + fourk = models.IntegerField(default=0) + fivek = models.IntegerField(default=0) + one_v_one = models.IntegerField(default=0) + one_v_two = models.IntegerField(default=0) + one_v_three = models.IntegerField(default=0) + one_v_four = models.IntegerField(default=0) + one_v_five = models.IntegerField(default=0) + f_kills = models.IntegerField(default=0) + f_deaths = models.IntegerField(default=0) + entries = models.IntegerField(default=0) + trades = models.IntegerField(default=0) + # rounds played + rounds = models.IntegerField(default=0) + avg_damage = models.IntegerField(default=0) + total_damage = models.IntegerField(default=0) + + +class MatchStats(models.Model): + matchid = models.PositiveIntegerField(default=0) + map = models.CharField(default="unknown", max_length=255) + team1 = models.CharField(default="unknown", max_length=255) + team2 = models.CharField(default="unknown", max_length=255) + + class SportChoice(models.Model): name = models.CharField(default='unknown sports', null=False, max_length=255) + def __str__(self): + return "" + self.name + class GameChoice(models.Model): name = models.CharField(default='unknown', null=False, max_length=255) @@ -54,7 +133,7 @@ class MapPoolChoice(models.Model): created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) - #def add_map(self, mappk): + # def add_map(self, mappk): # newmap = MapChoice.objects.get(id=mappk) # newmap.map_num = self.maps.count() + 1 # self.maps.add(newmap) @@ -66,14 +145,13 @@ def __str__(self): class Match(models.Model): type = models.CharField(blank=True, null=True, max_length=20) matchnum = models.SmallIntegerField(default=0) - #TODO add mtm field for maps - for cases that it is more then a BO1 - #maps = models.ManyToManyField(MapChoice, related_name='match_maps', on_delete=models.SET_NULL, null=True) - map = models.ForeignKey(MapChoice, related_name='match_map', on_delete=models.SET_NULL, null=True) + map_pool = models.ForeignKey(MapPoolChoice, related_name='mappoolchoice', on_delete=models.SET_NULL, null=True) + maps = models.ManyToManyField(MapChoice, blank=True) game = models.ForeignKey(GameChoice, related_name='GameChoice', on_delete=models.PROTECT, null=True) # default to ps4 for now bc why not platform = models.ForeignKey(PlatformChoice, related_name='PlatformChoice', on_delete=models.PROTECT, null=True) # support for traditional sports - sport = models.ForeignKey(SportChoice, related_name='SportChoice', on_delete=models.PROTECT, null=True) + sport = models.ForeignKey(SportChoice, related_name='SportChoice', on_delete=models.PROTECT, null=True, blank=True) # assign the match to a tournament with a FK # tournament = models.ForeignKey(SingleEliminationTournament, related_name='tournament', on_delete=models.CASCADE) # fk fields for the 2 teams that are competiting, @@ -86,11 +164,12 @@ class Match(models.Model): reported = models.BooleanField(default=False) # simple bool field to see if the entire match is completed completed = models.BooleanField(default=False) + config_generated = models.BooleanField(default=False) # field to declare the winner - winner = models.ForeignKey(Team, related_name='champions', on_delete=models.SET_NULL, null=True) - loser = models.ForeignKey(Team, related_name='loser', on_delete=models.SET_NULL, null=True) + winner = models.ForeignKey(Team, related_name='champions', on_delete=models.SET_NULL, null=True, blank=True) + loser = models.ForeignKey(Team, related_name='loser', on_delete=models.SET_NULL, null=True, blank=True) # set the default map format to best of 1 - bestof = models.SmallIntegerField(choices=MAPFORMAT_CHOICES, default=0) + bestof = models.SmallIntegerField(choices=MAPFORMAT_CHOICES, default=1) # by default set it to be a 2v2. teamformat = models.SmallIntegerField(choices=TEAMFORMAT_CHOICES, default=1) @@ -101,8 +180,9 @@ class Match(models.Model): team2reportedwinner = models.ForeignKey(Team, related_name='team2reportedwinner', on_delete=models.SET_NULL, null=True, blank=True) - # TODO: implement datetime field for matches - #datetime = models.DateTimeField(null=True) + server = models.CharField(blank=True, null=True, max_length=255) + + datetime = models.DateTimeField(null=True, blank=True) info = models.TextField(default="Match Info: ") @@ -136,6 +216,14 @@ def get_min_team_size(self): return 6 +class MatchCheckIn(models.Model): + match = models.ForeignKey(Match, related_name='match_checkin', on_delete=models.SET_NULL, null=True) + reporter = models.ForeignKey(User, related_name='checkin_user', on_delete=models.SET_NULL, null=True) + team = models.ForeignKey(Team, related_name='checking_in_team', on_delete=models.SET_NULL, null=True) + # players should == match.get_min_team_size + players = models.ManyToManyField(User) + + class MatchReport(models.Model): created = models.DateTimeField(auto_now_add=True) # see the time the report was made for admins diff --git a/matches/settings.py b/matches/settings.py index 54ba3adca..f562aed87 100644 --- a/matches/settings.py +++ b/matches/settings.py @@ -10,9 +10,9 @@ )) MAPFORMAT_CHOICES = getattr(settings, 'MATCHES_MAPFORMAT_CHOICES', ( - (0, 'Best of 1'), - (1, 'Best of 3'), - (2, 'Best of 5'), - (3, 'Best of 7'), - (4, 'Best of 9'), + (1, 'Best of 1'), + (2, 'Best of 2'), + (3, 'Best of 3'), + (4, 'Best of 4'), + (5, 'Best of 5'), )) diff --git a/matches/urls.py b/matches/urls.py index dd3b963d4..7beac78ec 100644 --- a/matches/urls.py +++ b/matches/urls.py @@ -10,6 +10,7 @@ path('/', login_required(TournamentMatchDetailView.as_view()), name='detail'), path('/report/', login_required(MatchReportCreateView.as_view()), name='report'), path('/dispute/', login_required(MatchDisputeReportCreateView.as_view()), name='dispute'), - path('maps//', login_required(MapPoolDetail.as_view()), name='maps_detail') - + path('maps//', login_required(MapPoolDetail.as_view()), name='maps_detail'), + path('/checkin/', login_required(match_checkin), name='checkin'), + path('/checkin//', login_required(team_checkin), name='team_checkin') ] diff --git a/matches/views.py b/matches/views.py index afff4b6ab..20591c5d3 100644 --- a/matches/views.py +++ b/matches/views.py @@ -1,15 +1,17 @@ from django.conf import settings from django.contrib import messages +from django.contrib.auth.models import User from django.contrib.sites.shortcuts import get_current_site from django.core.mail import EmailMessage from django.shortcuts import get_object_or_404 from django.shortcuts import render, redirect from django.template.loader import render_to_string from django.views.generic import DetailView, CreateView, View - -from matches.models import Match, MatchReport, MatchDispute, MapPoolChoice -from teams.models import Team, TeamInvite -from .forms import MatchReportCreateFormGet, MatchReportCreateFormPost, DisputeCreateForm +from matches.models import Match, MatchReport, MatchDispute, MapPoolChoice, MatchCheckIn +from teams.models import Team +from .forms import MatchReportCreateFormGet, MatchReportCreateFormPost, DisputeCreateForm, TeamCheckInFormGet, TeamCheckInFormPost +from profiles.models import Notification, UserProfile +import datetime class MapPoolDetail(DetailView): @@ -23,10 +25,12 @@ def get(self, request, **kwargs): class MatchList(View): def get(self, request): - invites = TeamInvite.objects.filter(hasPerms=True, user_id=request.user.id) - team = list(Team.objects.filter(id__in=invites.values_list('team', flat=True))) - matches_away = Match.objects.filter(awayteam__in=team) - matches_home = Match.objects.filter(hometeam__in=team) + # teams = Team.objects.filter( + # Q(captains__exact=request.user) | Q(founder=request.user) | Q(players__exact=request.user)) + profile = UserProfile.objects.get(user=request.user) + teams = profile.player_teams.all() | profile.captain_teams.all() | profile.founder_teams.all() + matches_away = Match.objects.filter(awayteam__in=teams) + matches_home = Match.objects.filter(hometeam__in=teams) matches = matches_away | matches_home return render(request, 'matches/matches_list.html', {'matches': matches}) @@ -63,7 +67,7 @@ class MatchReportCreateView(View): def get(self, request, pk): form = MatchReportCreateFormGet(request, pk) match = get_object_or_404(Match, pk) - if match.disable_userreports: + if match.disable_userreport: # user reports are disabled, return them to the match detail page with an error messages.error(request, "Match reports are disabled for this match") return redirect('matches:detail', pk=pk) @@ -77,128 +81,140 @@ def post(self, request, pk): if not match.bye_2 and not match.bye_1: team1 = Team.objects.get(id=match.hometeam_id) team2 = Team.objects.get(id=match.awayteam_id) - team1_reporters = TeamInvite.objects.filter(team=team1, hasPerms=True) - team2_reporters = TeamInvite.objects.filter(team=team2, hasPerms=True) + team1_reporters = team1.captains + team2_reporters = team2.captains - if TeamInvite.objects.filter(user=self.request.user, team=team1).exists(): - reporter_team = TeamInvite.objects.get(user=self.request.user, team=team1) - elif TeamInvite.objects.filter(user=self.request.user, team=team2).exists(): - reporter_team = TeamInvite.objects.get(user=self.request.user, team=team2) + one_perms = False + two_perms = False + if self.request.user in team1.captain.all() or self.request.user == team1.founder: + one_perms = True + elif self.request.user in team2.captain.all() or self.request.user == team2.founder: + two_perms = True else: - messages.error(request, message="You aren't a part of the teams in this match") + messages.error(request, message="You don't have permission to report for any team in this match") if match.type == 'w': return redirect('wagers:list') return redirect('matches:detail', pk=pk) if MatchReport.objects.filter(match=match.id, - reporting_team=team1).exists() and reporter_team.id == team1.id: + reporting_team=team1).exists() and one_perms: messages.error(request, "Your team has already reported this match") if match.type == 'w': return redirect('wagers:list') return redirect('matches:detail', pk=pk) elif MatchReport.objects.filter(match=match.id, - reporting_team=team2).exists() and reporter_team.id == team2.id: + reporting_team=team2).exists() and two_perms: messages.error(request, "Your team has already reported this match") if match.type == 'w': return redirect('wagers:list') return redirect('matches:detail', pk=pk) + elif match.bye_1: + messages.error(request, 'There is only one team in this match, reporting is unnecessary') + return redirect('matches:list') + + elif match.bye_2: + messages.error(request, 'There are no teams in this match') + return redirect('matches:list') else: - if reporter_team in team1_reporters or reporter_team in team2_reporters: - report.match = match - report.reporting_team = reporter_team.team - reported_team = Team.objects.get(id=form.data['reported_winner']) - report.reported_winner = reported_team - if reporter_team.team == team1: - match.team1reported = True - match.team1reportedwinner = report.reported_winner - match.team1reportedwinner_id = report.reported_winner.id - elif reporter_team.team == team2: - match.team2reported = True - match.team2reportedwinner = report.reported_winner - match.team2reportedwinner_id = report.reported_winner.id - else: - messages.error(self.request, "Something went wrong (this shouldn't be seen)") - return redirect('singletournaments:list') - match.save() - report.save() - if match.team1reported and match.team2reported: - reports = MatchReport.objects.filter(match_id=match.id) - report1 = MatchReport.objects.get(reporting_team=team1, match_id=match.id) - report2 = MatchReport.objects.get(reporting_team=team2, match_id=match.id) - if reports[0].reported_winner != reports[1].reported_winner: - dispute = MatchDispute(id=match.id, match=match, team1=team1, team2=team2, - team1origreporter=report1.reporting_user, - team2origreporter=report2.reporting_user) - dispute.save() - match.disputed = True - match.save() + # if reporter_team in team1_reporters or reporter_team in team2_reporters: + report.match = match + reported_team = Team.objects.get(id=form.data['reported_winner']) + report.reported_winner = reported_team + if one_perms: + report.reporting_team = team1 + match.team1reported = True + match.team1reportedwinner = report.reported_winner + match.team1reportedwinner_id = report.reported_winner.id - for i in [report1.reporting_user, report2.reporting_user]: - if i.user.email_enabled: - current_site = get_current_site(request) - mail_subject = settings.SITE_NAME + ' match disputed!' - message = render_to_string('matches/dispute_email.html', { - 'user': i.username, - 'site': settings.SITE_NAME, - 'domain': current_site.domain, - 'pk': dispute.pk - }) - to_email = i.email - email = EmailMessage( - mail_subject, message, from_email=settings.FROM_EMAIL, to=[to_email] - ) - email.send() - - messages.warning(self.request, - "Both teams have reported different winners; a dispute has been created") - return redirect('matches:dispute', pk=dispute.pk) - if match.team1reported: - # team 1 reported - if match.team1reportedwinner == team2: - # team1 is reporting that team2 won - # declare team2 as winner - match.winner = team2 - match.loser = team1 - match.save() - elif match.team1reportedwinner == team1: - # have to wait for the other team to confirm - pass - elif match.team2reported: - if match.team2reportedwinner == team1: - # team 1 wins - match.winner = team1 - match.loser = team2 - match.save() - elif match.team2reportedwinner == team2: - pass - if match.team1reported and match.team2reported: - if match.team2reportedwinner == team2 and match.team1reportedwinner == team2: - match.winner = team2 - match.loser = team1 - match.save() - elif match.team2reportedwinner == team1 and match.team1reportedwinner == team1: - match.winner = team1 - match.loser = team2 - match.save() - # self.success_url = reverse('matches:detail', args=[match.id]) - messages.success(self.request, 'Your Report has been successfully submitted') - if match.type == 'w': - return redirect('wagers:list') - return redirect('matches:detail', pk=pk) + elif two_perms: + report.reporting_team = team2 + match.team2reported = True + match.team2reportedwinner = report.reported_winner + match.team2reportedwinner_id = report.reported_winner.id else: - messages.error(self.request, "You don't have permissions to report on this match") - if match.type == 'w': - return redirect('wagers:list') - return redirect('singletournaments:list') - # else: - # messages.error(request, "A report has already been created for this match") - # return redirect('matches:detail', pk=pk) - elif match.bye_1: - messages.error(request, 'There is only one team in this match, reporting is unnecessary') - return redirect('matches:list') - elif match.bye_2: - messages.error(request, 'There are no teams in this match') - return redirect('matches:list') + messages.error(request, "ERROR: Could not verify the team that you're on") + return redirect('matches:detail', pk=match.id) + + match.save() + report.save() + if match.team1reported and match.team2reported: + reports = MatchReport.objects.filter(match_id=match.id) + report1 = MatchReport.objects.get(reporting_team=team1, match_id=match.id) + report2 = MatchReport.objects.get(reporting_team=team2, match_id=match.id) + if reports[0].reported_winner != reports[1].reported_winner: + dispute = MatchDispute(id=match.id, match=match, team1=team1, team2=team2, + team1origreporter=report1.reporting_user, + team2origreporter=report2.reporting_user) + dispute.save() + match.disputed = True + match.save() + + for i in [report1.reporting_user, report2.reporting_user]: + test = Notification(title="A match you're playing in has been disputed") + test.link = 'matches:detail' + test.pk1 = match.pk + test.datetime = datetime.datetime.now() + test.save() + userprofile = UserProfile.objects.get(user=i.user) + userprofile.notifications.add(test) + userprofile.save() + if i.user.email_enabled: + current_site = get_current_site(request) + mail_subject = settings.SITE_NAME + ' match disputed!' + message = render_to_string('matches/dispute_email.html', { + 'user': i.username, + 'site': settings.SITE_NAME, + 'domain': current_site.domain, + 'pk': dispute.pk + }) + to_email = i.email + email = EmailMessage( + mail_subject, message, from_email=settings.FROM_EMAIL, to=[to_email] + ) + email.send(fail_silently=True) + + messages.warning(self.request, + "Both teams have reported different winners; a dispute has been created") + return redirect('matches:dispute', pk=dispute.pk) + if match.team1reported: + # team 1 reported + if match.team1reportedwinner == team2: + # team1 is reporting that team2 won + # declare team2 as winner + match.winner = team2 + match.loser = team1 + match.save() + elif match.team1reportedwinner == team1: + # have to wait for the other team to confirm + pass + elif match.team2reported: + if match.team2reportedwinner == team1: + # team 1 wins + match.winner = team1 + match.loser = team2 + match.save() + elif match.team2reportedwinner == team2: + pass + if match.team1reported and match.team2reported: + if match.team2reportedwinner == team2 and match.team1reportedwinner == team2: + match.winner = team2 + match.loser = team1 + match.save() + elif match.team2reportedwinner == team1 and match.team1reportedwinner == team1: + match.winner = team1 + match.loser = team2 + match.save() + # self.success_url = reverse('matches:detail', args=[match.id]) + messages.success(self.request, 'Your Report has been successfully submitted') + if match.type == 'w': + return redirect('wagers:list') + return redirect('matches:detail', pk=pk) + # if match.type == 'w': + # return redirect('wagers:list') + # return redirect('singletournaments:list') + # else: + # messages.error(request, "A report has already been created for this match") + # return redirect('matches:detail', pk=pk) class MatchDisputeReportCreateView(CreateView): @@ -230,3 +246,65 @@ def form_valid(self, form, **kwargs): dispute.team1origreporter = matchreport_1.reporting_user dispute.save() return redirect('matches:detail', pk=self.kwargs['pk']) + + +def match_checkin(request, pk): + match = Match.objects.get(pk=pk) + profile = UserProfile.objects.get(user__username=request.user.username) + user = request.user + away = match.awayteam + home = match.hometeam + if (user in away.captain.all() or user in home.captain.all()) or (user == away.founder or user == home.founder): + return render(request, 'matches/match_checkin.html', {'match': match}) + else: + messages.error(request, "You don't have permission to checkin for this match") + return redirect('matches:detail', pk=pk) + + +def team_checkin(request, pk, teamid): + # get the team they're trying to checkin from the get + team = Team.objects.get(pk=teamid) + # get the match from the pk in the url + match = Match.objects.get(pk=pk) + # get logged in user + profile = UserProfile.objects.get(user__username=request.user.username) + user = request.user + if user == team.founder: + pass + elif user == team.captain.all(): + pass + else: + # they don't have perms - gtfo + messages.error(request, "FFFFFYou do not have permissions to checkin this team") + return redirect('matches:detail', pk=pk) + if request.method == 'GET': + # send the form, render + form = TeamCheckInFormGet(team=team) + return render(request, 'matches/team_checkin.html', {'form': form, 'match': match, 'teamid': teamid}) + elif request.method == 'POST': + # lets make it and get the data + # TODO: find a way to get the team instance in the form + form = TeamCheckInFormPost(request.POST) + if form.is_valid(): + temp = MatchCheckIn() + temp.save() + temp.match = match + temp.team = team + temp.reporter = user + # TODO: verify posted data from form of field 'players' + for playerid in form.data.getlist('players'): + playerid = int(playerid) + player = User.objects.get(pk=playerid) + temp.players.add(player) + temp.save() + messages.success(request, 'Your team has been checked in, checkin #' + str(temp.pk)) + return redirect('matches:detail', pk=match.pk) + else: + print('dammit') + print(form.cleaned_data) + messages.error(request, "Form error, this should not occur") + return redirect('matches:detail', pk=pk) + + +def create_checkin(request, pk): + pass diff --git a/news/migrations/0001_initial.py b/news/migrations/0001_initial.py index c23029651..2430929b0 100644 --- a/news/migrations/0001_initial.py +++ b/news/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.0.2 on 2018-08-03 15:10 +# Generated by Django 2.2.15 on 2020-12-09 20:08 from django.conf import settings from django.db import migrations, models @@ -7,6 +7,7 @@ class Migration(migrations.Migration): + initial = True dependencies = [ @@ -15,46 +16,37 @@ class Migration(migrations.Migration): operations = [ migrations.CreateModel( - name='Comment', + name='Post', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=80)), - ('email', models.EmailField(max_length=254)), + ('title', models.CharField(max_length=250)), + ('slug', models.SlugField(max_length=250, unique_for_date='publish')), ('body', models.TextField()), + ('publish', models.DateTimeField(blank=True, default=django.utils.timezone.now, null=True)), ('created', models.DateTimeField(auto_now_add=True)), ('updated', models.DateTimeField(auto_now=True)), - ('active', models.BooleanField(default=True)), + ('status', models.CharField(choices=[('draft', 'Draft'), ('scheduled', 'Scheduled'), ('published', 'Published'), ('private', 'Private')], default='draft', max_length=12)), + ('image', models.ImageField(blank=True, upload_to='news_images')), + ('author', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='blog_posts', to=settings.AUTH_USER_MODEL)), ], options={ - 'ordering': ('created',), + 'ordering': ('-publish',), }, ), migrations.CreateModel( - name='Post', + name='Comment', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=250)), - ('slug', models.SlugField(max_length=250, unique_for_date='publish')), + ('name', models.CharField(max_length=80)), + ('email', models.EmailField(max_length=254)), ('body', models.TextField()), - ('publish', models.DateTimeField(blank=True, default=django.utils.timezone.now)), ('created', models.DateTimeField(auto_now_add=True)), ('updated', models.DateTimeField(auto_now=True)), - ('status', models.CharField( - choices=[('draft', 'Draft'), ('scheduled', 'Scheduled'), ('published', 'Published'), - ('private', 'Private')], default='draft', max_length=12)), - ('image', models.ImageField(blank=True, upload_to='news_images')), - ('author', - models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='blog_posts', - to=settings.AUTH_USER_MODEL)), + ('active', models.BooleanField(default=True)), + ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='news.Post')), ], options={ - 'ordering': ('-publish',), + 'ordering': ('created',), }, ), - migrations.AddField( - model_name='comment', - name='post', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', - to='news.Post'), - ), ] diff --git a/news/migrations/0002_auto_20190713_1335.py b/news/migrations/0002_auto_20190713_1335.py deleted file mode 100644 index 44d07fbe9..000000000 --- a/news/migrations/0002_auto_20190713_1335.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 2.2.2 on 2019-07-13 17:35 - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('news', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='post', - name='author', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='blog_posts', to=settings.AUTH_USER_MODEL), - ), - ] diff --git a/news/migrations/0003_auto_20200507_1737.py b/news/migrations/0003_auto_20200507_1737.py deleted file mode 100644 index 12f807de0..000000000 --- a/news/migrations/0003_auto_20200507_1737.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-07 17:37 - -from django.db import migrations, models -import django.utils.timezone - - -class Migration(migrations.Migration): - - dependencies = [ - ('news', '0002_auto_20190713_1335'), - ] - - operations = [ - migrations.AlterField( - model_name='post', - name='publish', - field=models.DateTimeField(default=django.utils.timezone.now, null=True), - ), - ] diff --git a/news/migrations/0004_auto_20200507_1741.py b/news/migrations/0004_auto_20200507_1741.py deleted file mode 100644 index 995ab695f..000000000 --- a/news/migrations/0004_auto_20200507_1741.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-07 17:41 - -from django.db import migrations, models -import django.utils.timezone - - -class Migration(migrations.Migration): - - dependencies = [ - ('news', '0003_auto_20200507_1737'), - ] - - operations = [ - migrations.AlterField( - model_name='post', - name='publish', - field=models.DateTimeField(blank=True, default=django.utils.timezone.now, null=True), - ), - ] diff --git a/news/tests.py b/news/tests.py index 787871c44..79ae234c8 100644 --- a/news/tests.py +++ b/news/tests.py @@ -5,7 +5,6 @@ class PostTestCase1(TestCase): - fixtures = ['pages.json'] def setUp(self): self.factory = RequestFactory() diff --git a/olly/base_settings.py b/olly/base_settings.py index 925c59121..29ce0a86b 100644 --- a/olly/base_settings.py +++ b/olly/base_settings.py @@ -82,6 +82,22 @@ 'django_cleanup.apps.CleanupConfig' ] +try: + if os.environ['enable_store'] == 'True': + STORE_ENABLED = True + else: + STORE_ENABLED = False +except KeyError: + STORE_ENABLED = False + +try: + if os.environ['enable_wagers'] == 'True': + WAGERS_ENABLED = True + else: + WAGERS_ENABLED = False +except KeyError: + WAGERS_ENABLED = False + MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', @@ -158,4 +174,4 @@ LOGIN_REDIRECT_URL = '/' LOGIN_URL = '/login/' -SITE_VERSION = "0.9.0" +SITE_VERSION = "1.0.0" diff --git a/olly/context_processors.py b/olly/context_processors.py index 17627f4e8..38fd83044 100644 --- a/olly/context_processors.py +++ b/olly/context_processors.py @@ -14,4 +14,6 @@ def site_info(request): 'SITE_SERVER': settings.SITE_SERVER, 'SITE_VERSION': settings.SITE_VERSION, 'SocialInfo': SocialInfo, - 'ESPORTS_MODE': settings.ESPORTS_MODE} + 'ESPORTS_MODE': settings.ESPORTS_MODE, + 'STORE_ENABLED': settings.STORE_ENABLED, + 'WAGERS_ENABLED': settings.WAGERS_ENABLED} diff --git a/olly/settings.py b/olly/settings.py index 465d47ed7..e90253f69 100644 --- a/olly/settings.py +++ b/olly/settings.py @@ -76,7 +76,12 @@ EMAIL_HOST_PASSWORD = os.environ['email_host_password'] FROM_EMAIL = os.environ['from_email'].split('"')[1] EMAIL_PORT = os.environ['email_port'] -PAYPAL_EMAIL = os.environ['paypal_email'] + +try: + PAYPAL_EMAIL = os.environ['paypal_email'].split('"')[1] +except (KeyError, IndexError): + PAYPAL_EMAIL = 'none@example.com' + # Captcha GOOGLE_RECAPTCHA_SECRET_KEY = os.environ['google_recaptcha_secret_key'] diff --git a/olly/travis_settings.py b/olly/travis_settings.py deleted file mode 100644 index 11a0a205b..000000000 --- a/olly/travis_settings.py +++ /dev/null @@ -1,62 +0,0 @@ -import os - -from .base_settings import * - -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'CI_BUILD' - -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -# SECURITY WARNING: don't run with this set to true in prod -PAYPAL_TEST = True - -ALLOWED_HOSTS = ['*'] - -SITE_URL = '127.0.0.1' - -WSGI_APPLICATION = 'olly.wsgi.application' - -try: - if os.environ['user_verification'] == 'True': - USER_VERIFICATION = True - else: - USER_VERIFICATION = False -except KeyError: - USER_VERIFICATION = False - -try: - if os.environ['esports_mode'] == 'False': - ESPORTS_MODE = False - else: - ESPORTS_MODE = True -except KeyError: - ESPORTS_MODE = True - -# Database -# https://docs.djangoproject.com/en/1.11/ref/settings/#databases -if 'TRAVIS' in os.environ: - DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql', - 'NAME': 'travis_ci_test', - 'USER': 'postgres', - 'PASSWORD': '', - 'HOST': 'localhost', - 'PORT': '', - } - } -else: - DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'test-db.sqlite3'), - } - } - -# Media files -MEDIA_ROOT = os.path.join(BASE_DIR, 'olly/media') - -# Site info -SITE_NAME = "Dev-Environment" -SITE_SERVER = "Dev-Environment" diff --git a/pages/fixtures/pages.json b/pages/fixtures/pages.json deleted file mode 100644 index aa38aeeec..000000000 --- a/pages/fixtures/pages.json +++ /dev/null @@ -1,32 +0,0 @@ -[ - { - "model": "pages.socialinfo", - "pk": 1, - "fields": { - "twitchchannel": null, - "youtubechannel": null, - "twitterprofile": "http://twitter.com/NFM_Studios", - "facebookpage": null, - "instagrampage": null, - "stream": null - } - }, - { - "model": "pages.staticinfo", - "pk": 1, - "fields": { - "featured_tournament": null, - "about_us": "about us", - "terms": "terms of service", - "block1text": null, - "block1link": null, - "block1_img": "", - "block2text": null, - "block2link": null, - "block2_img": "", - "block3text": null, - "block3link": null, - "block3_img": "" - } - } -] \ No newline at end of file diff --git a/pages/migrations/0001_initial.py b/pages/migrations/0001_initial.py index 96186d6f3..094283374 100644 --- a/pages/migrations/0001_initial.py +++ b/pages/migrations/0001_initial.py @@ -1,37 +1,76 @@ -# Generated by Django 2.0.5 on 2018-07-03 23:46 +# Generated by Django 2.2.15 on 2020-12-09 20:08 from django.db import migrations, models +import django.db.models.deletion class Migration(migrations.Migration): + initial = True dependencies = [ + ('singletournaments', '0001_initial'), ] operations = [ + migrations.CreateModel( + name='FrontPageSlide', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('header', models.CharField(blank=True, default='', max_length=50, null=True)), + ('subhead', models.CharField(blank=True, default='', max_length=100, null=True)), + ('link', models.URLField(blank=True, null=True)), + ('image', models.ImageField(blank=True, upload_to='carousel_images')), + ], + options={ + 'verbose_name_plural': 'Front Page Slides', + }, + ), migrations.CreateModel( name='Partner', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=80)), - ('website', models.URLField(blank=True, default='#')), + ('website', models.URLField(blank=True, null=True)), ('twitter', models.CharField(blank=True, default='#', max_length=100)), ('bio', models.TextField()), ('logo', models.ImageField(blank=True, upload_to='partner_images')), ], ), + migrations.CreateModel( + name='SocialInfo', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('twitchchannel', models.URLField(blank=True, null=True, verbose_name='twitch_channel')), + ('youtubechannel', models.URLField(blank=True, null=True, verbose_name='youtube_channel')), + ('twitterprofile', models.URLField(blank=True, null=True, verbose_name='twitter_profile')), + ('facebookpage', models.URLField(blank=True, null=True, verbose_name='facebook_page')), + ('instagrampage', models.URLField(blank=True, null=True, verbose_name='instagram_page')), + ('stream', models.CharField(blank=True, max_length=25, null=True)), + ], + options={ + 'verbose_name_plural': 'Social info', + }, + ), migrations.CreateModel( name='StaticInfo', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('about_us', models.TextField(default='about us')), ('terms', models.TextField(default='terms of service')), - ('privacy', models.TextField(default='privacy policy')), - ('stream', models.CharField(default='twitch', max_length=25)), - ('slide1link', models.TextField(default='#')), - ('slide2link', models.TextField(default='#')), - ('slide3link', models.TextField(default='#')), + ('block1text', models.CharField(blank=True, default='', max_length=50, null=True)), + ('block1link', models.URLField(blank=True, null=True)), + ('block1_img', models.ImageField(blank=True, upload_to='carousel_images')), + ('block2text', models.CharField(blank=True, default='', max_length=50, null=True)), + ('block2link', models.URLField(blank=True, null=True)), + ('block2_img', models.ImageField(blank=True, upload_to='carousel_images')), + ('block3text', models.CharField(blank=True, default='', max_length=50, null=True)), + ('block3link', models.URLField(blank=True, null=True)), + ('block3_img', models.ImageField(blank=True, upload_to='carousel_images')), + ('featured_tournament', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='featured_tournament', to='singletournaments.SingleEliminationTournament')), ], + options={ + 'verbose_name_plural': 'Static info', + }, ), ] diff --git a/pages/migrations/0002_auto_20180916_1705.py b/pages/migrations/0002_auto_20180916_1705.py deleted file mode 100644 index b9d9d2c2c..000000000 --- a/pages/migrations/0002_auto_20180916_1705.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.0.5 on 2018-09-16 21:05 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('pages', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='staticinfo', - name='welcomeln1', - field=models.CharField(default='welcome text', max_length=25), - ), - migrations.AddField( - model_name='staticinfo', - name='welcomeln2', - field=models.CharField(default='', max_length=25), - ), - ] diff --git a/pages/migrations/0003_auto_20180920_2018.py b/pages/migrations/0003_auto_20180920_2018.py deleted file mode 100644 index cb1763dc6..000000000 --- a/pages/migrations/0003_auto_20180920_2018.py +++ /dev/null @@ -1,41 +0,0 @@ -# Generated by Django 2.0.4 on 2018-09-21 00:18 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('pages', '0002_auto_20180916_1705'), - ] - - operations = [ - migrations.RemoveField( - model_name='staticinfo', - name='privacy', - ), - migrations.AddField( - model_name='staticinfo', - name='slide1_img', - field=models.ImageField(blank=True, upload_to='carousel_images'), - ), - migrations.AddField( - model_name='staticinfo', - name='slide2_img', - field=models.ImageField(blank=True, upload_to='carousel_images'), - ), - migrations.AddField( - model_name='staticinfo', - name='slide3_img', - field=models.ImageField(blank=True, upload_to='carousel_images'), - ), - migrations.AlterField( - model_name='staticinfo', - name='welcomeln1', - field=models.CharField(default='welcome1', max_length=25), - ), - migrations.AlterField( - model_name='staticinfo', - name='welcomeln2', - field=models.CharField(default='welcome2', max_length=25), - ), - ] diff --git a/pages/migrations/0004_auto_20181008_1545.py b/pages/migrations/0004_auto_20181008_1545.py deleted file mode 100644 index 422eb2157..000000000 --- a/pages/migrations/0004_auto_20181008_1545.py +++ /dev/null @@ -1,87 +0,0 @@ -# Generated by Django 2.0.5 on 2018-10-08 19:45 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('pages', '0003_auto_20180920_2018'), - ] - - operations = [ - migrations.AddField( - model_name='staticinfo', - name='bingeslide1big', - field=models.TextField(default='Coming Soon!'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingeslide1link', - field=models.URLField(default='#'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingeslide1small', - field=models.TextField(default='Coming Soon!'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingeslide2big', - field=models.TextField(default='Coming Soon!'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingeslide2link', - field=models.URLField(default='#'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingeslide2small', - field=models.TextField(default='Coming Soon!'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingeslide3big', - field=models.TextField(default='Coming Soon!'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingeslide3link', - field=models.URLField(default='#'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingeslide3small', - field=models.TextField(default='Coming Soon!'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingetop1', - field=models.TextField(default='Coming Soon!'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingetop1link', - field=models.URLField(default='#'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingetop2', - field=models.TextField(default='Coming Soon!'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingetop2link', - field=models.URLField(default='#'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingetop3', - field=models.TextField(default='Coming Soon!'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingetop3link', - field=models.URLField(default='#'), - ), - ] diff --git a/pages/migrations/0005_auto_20181012_1849.py b/pages/migrations/0005_auto_20181012_1849.py deleted file mode 100644 index 798d3d729..000000000 --- a/pages/migrations/0005_auto_20181012_1849.py +++ /dev/null @@ -1,27 +0,0 @@ -# Generated by Django 2.0.4 on 2018-10-12 22:49 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('pages', '0004_auto_20181008_1545'), - ] - - operations = [ - migrations.AddField( - model_name='staticinfo', - name='bingetop1image', - field=models.ImageField(blank=True, upload_to='carousel_images'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingetop2image', - field=models.ImageField(blank=True, upload_to='carousel_images'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingetop3image', - field=models.ImageField(blank=True, upload_to='carousel_images'), - ), - ] diff --git a/pages/migrations/0006_auto_20181012_1953.py b/pages/migrations/0006_auto_20181012_1953.py deleted file mode 100644 index 09f15ff65..000000000 --- a/pages/migrations/0006_auto_20181012_1953.py +++ /dev/null @@ -1,102 +0,0 @@ -# Generated by Django 2.0.4 on 2018-10-12 23:53 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('pages', '0005_auto_20181012_1849'), - ] - - operations = [ - migrations.AlterField( - model_name='staticinfo', - name='bingeslide1big', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingeslide1link', - field=models.URLField(blank=True, default='#', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingeslide1small', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingeslide2big', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingeslide2link', - field=models.URLField(blank=True, default='#', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingeslide2small', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingeslide3big', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingeslide3link', - field=models.URLField(blank=True, default='#', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingeslide3small', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingetop1', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingetop1link', - field=models.URLField(blank=True, default='#', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingetop2', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingetop2link', - field=models.URLField(blank=True, default='#', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingetop3', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingetop3link', - field=models.URLField(blank=True, default='#', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='slide1link', - field=models.TextField(blank=True, default='#', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='slide2link', - field=models.TextField(blank=True, default='#', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='slide3link', - field=models.TextField(blank=True, default='#', null=True), - ), - ] diff --git a/pages/migrations/0007_auto_20190206_1617.py b/pages/migrations/0007_auto_20190206_1617.py deleted file mode 100644 index 8d2c4a906..000000000 --- a/pages/migrations/0007_auto_20190206_1617.py +++ /dev/null @@ -1,37 +0,0 @@ -# Generated by Django 2.0.10 on 2019-02-06 21:17 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('pages', '0006_auto_20181012_1953'), - ] - - operations = [ - migrations.AddField( - model_name='staticinfo', - name='facebookpage', - field=models.URLField(default='#', verbose_name='facebook_page'), - ), - migrations.AddField( - model_name='staticinfo', - name='instagrampage', - field=models.URLField(default='#', verbose_name='instagram_page'), - ), - migrations.AddField( - model_name='staticinfo', - name='twitchchannel', - field=models.URLField(default='#', verbose_name='twitch_channel'), - ), - migrations.AddField( - model_name='staticinfo', - name='twitterprofile', - field=models.URLField(default='#', verbose_name='twitter_profile'), - ), - migrations.AddField( - model_name='staticinfo', - name='youtubechannel', - field=models.URLField(default='#', verbose_name='youtube_channel'), - ), - ] diff --git a/pages/migrations/0008_auto_20190206_1624.py b/pages/migrations/0008_auto_20190206_1624.py deleted file mode 100644 index 5d31ca641..000000000 --- a/pages/migrations/0008_auto_20190206_1624.py +++ /dev/null @@ -1,37 +0,0 @@ -# Generated by Django 2.0.10 on 2019-02-06 21:24 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('pages', '0007_auto_20190206_1617'), - ] - - operations = [ - migrations.AlterField( - model_name='staticinfo', - name='facebookpage', - field=models.URLField(blank=True, null=True, verbose_name='facebook_page'), - ), - migrations.AlterField( - model_name='staticinfo', - name='instagrampage', - field=models.URLField(blank=True, null=True, verbose_name='instagram_page'), - ), - migrations.AlterField( - model_name='staticinfo', - name='twitchchannel', - field=models.URLField(blank=True, null=True, verbose_name='twitch_channel'), - ), - migrations.AlterField( - model_name='staticinfo', - name='twitterprofile', - field=models.URLField(blank=True, null=True, verbose_name='twitter_profile'), - ), - migrations.AlterField( - model_name='staticinfo', - name='youtubechannel', - field=models.URLField(blank=True, null=True, verbose_name='youtube_channel'), - ), - ] diff --git a/pages/migrations/0009_auto_20190206_1628.py b/pages/migrations/0009_auto_20190206_1628.py deleted file mode 100644 index 029458a62..000000000 --- a/pages/migrations/0009_auto_20190206_1628.py +++ /dev/null @@ -1,42 +0,0 @@ -# Generated by Django 2.0.10 on 2019-02-06 21:28 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('pages', '0008_auto_20190206_1624'), - ] - - operations = [ - migrations.AlterField( - model_name='staticinfo', - name='facebookpage', - field=models.URLField(blank=True, default='https://www.facebook.com', null=True, - verbose_name='facebook_page'), - ), - migrations.AlterField( - model_name='staticinfo', - name='instagrampage', - field=models.URLField(blank=True, default='https://www.instagram.com', null=True, - verbose_name='instagram_page'), - ), - migrations.AlterField( - model_name='staticinfo', - name='twitchchannel', - field=models.URLField(blank=True, default='https://www.twitch.tv', null=True, - verbose_name='twitch_channel'), - ), - migrations.AlterField( - model_name='staticinfo', - name='twitterprofile', - field=models.URLField(blank=True, default='https://www.twitter.com', null=True, - verbose_name='twitter_profile'), - ), - migrations.AlterField( - model_name='staticinfo', - name='youtubechannel', - field=models.URLField(blank=True, default='https://www.youtube.com', null=True, - verbose_name='youtube_channel'), - ), - ] diff --git a/pages/migrations/0010_auto_20190207_1944.py b/pages/migrations/0010_auto_20190207_1944.py deleted file mode 100644 index def6055e1..000000000 --- a/pages/migrations/0010_auto_20190207_1944.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.1.5 on 2019-02-08 00:44 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('pages', '0009_auto_20190206_1628'), - ] - - operations = [ - migrations.AlterField( - model_name='staticinfo', - name='welcomeln1', - field=models.CharField(blank=True, default='welcome1', max_length=25, null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='welcomeln2', - field=models.CharField(blank=True, default='welcome2', max_length=25, null=True), - ), - ] diff --git a/pages/migrations/0011_auto_20190217_1554.py b/pages/migrations/0011_auto_20190217_1554.py deleted file mode 100644 index 9d051bdf8..000000000 --- a/pages/migrations/0011_auto_20190217_1554.py +++ /dev/null @@ -1,48 +0,0 @@ -# Generated by Django 2.1.5 on 2019-02-17 20:54 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('pages', '0010_auto_20190207_1944'), - ] - - operations = [ - migrations.AddField( - model_name='staticinfo', - name='bingetop1linktxt', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='bingetop2linktxt', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='bingetop3linktxt', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='bingetop4', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='bingetop4image', - field=models.ImageField(blank=True, upload_to='carousel_images'), - ), - migrations.AddField( - model_name='staticinfo', - name='bingetop4link', - field=models.URLField(blank=True, default='#', null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='bingetop4linktxt', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - ] diff --git a/pages/migrations/0012_auto_20190312_1956.py b/pages/migrations/0012_auto_20190312_1956.py deleted file mode 100644 index 9eddc3f0a..000000000 --- a/pages/migrations/0012_auto_20190312_1956.py +++ /dev/null @@ -1,63 +0,0 @@ -# Generated by Django 2.1.7 on 2019-03-12 23:56 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('pages', '0011_auto_20190217_1554'), - ] - - operations = [ - migrations.AlterField( - model_name='staticinfo', - name='bingeslide1link', - field=models.URLField(blank=True, default='https://www.google.com', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingeslide2link', - field=models.URLField(blank=True, default='https://www.google.com', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingeslide3link', - field=models.URLField(blank=True, default='https://www.google.com', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingetop1link', - field=models.URLField(blank=True, default='https://www.google.com', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingetop2link', - field=models.URLField(blank=True, default='https://www.google.com', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingetop3link', - field=models.URLField(blank=True, default='https://www.google.com', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='bingetop4link', - field=models.URLField(blank=True, default='https://www.google.com', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='slide1link', - field=models.TextField(blank=True, default='https://www.google.com', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='slide2link', - field=models.TextField(blank=True, default='https://www.google.com', null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='slide3link', - field=models.TextField(blank=True, default='https://www.google.com', null=True), - ), - ] diff --git a/pages/migrations/0013_auto_20190313_1311.py b/pages/migrations/0013_auto_20190313_1311.py deleted file mode 100644 index 1cc0ac9ba..000000000 --- a/pages/migrations/0013_auto_20190313_1311.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 2.1.5 on 2019-03-13 17:11 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('singletournaments', '0012_auto_20190112_1546'), - ('pages', '0012_auto_20190312_1956'), - ] - - operations = [ - migrations.AddField( - model_name='staticinfo', - name='featured_touranment', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='featured_tournamet', to='singletournaments.SingleEliminationTournament'), - ), - migrations.AlterField( - model_name='partner', - name='website', - field=models.URLField(blank=True, default='https://www.google.com'), - ), - ] diff --git a/pages/migrations/0014_remove_staticinfo_featured_touranment.py b/pages/migrations/0014_remove_staticinfo_featured_touranment.py deleted file mode 100644 index 0e300ee2d..000000000 --- a/pages/migrations/0014_remove_staticinfo_featured_touranment.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 2.1.5 on 2019-03-13 17:22 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('pages', '0013_auto_20190313_1311'), - ] - - operations = [ - migrations.RemoveField( - model_name='staticinfo', - name='featured_touranment', - ), - ] diff --git a/pages/migrations/0015_staticinfo_featured_touranment.py b/pages/migrations/0015_staticinfo_featured_touranment.py deleted file mode 100644 index 163b20f76..000000000 --- a/pages/migrations/0015_staticinfo_featured_touranment.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 2.1.5 on 2019-03-13 17:23 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('singletournaments', '0012_auto_20190112_1546'), - ('pages', '0014_remove_staticinfo_featured_touranment'), - ] - - operations = [ - migrations.AddField( - model_name='staticinfo', - name='featured_touranment', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='featured_tournamet', to='singletournaments.SingleEliminationTournament'), - ), - ] diff --git a/pages/migrations/0016_auto_20190327_1727.py b/pages/migrations/0016_auto_20190327_1727.py deleted file mode 100644 index 1b7228d7e..000000000 --- a/pages/migrations/0016_auto_20190327_1727.py +++ /dev/null @@ -1,48 +0,0 @@ -# Generated by Django 2.1.5 on 2019-03-27 21:27 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('pages', '0015_staticinfo_featured_touranment'), - ] - - operations = [ - migrations.AddField( - model_name='staticinfo', - name='gatournament1', - field=models.ImageField(blank=True, upload_to='carousel_images'), - ), - migrations.AddField( - model_name='staticinfo', - name='gatournament1big', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='gatournament1small', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='gatournament2', - field=models.ImageField(blank=True, upload_to='carousel_images'), - ), - migrations.AddField( - model_name='staticinfo', - name='gatournament2big', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='gatournament2small', - field=models.TextField(blank=True, default='Coming Soon!', null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='gatournamentbig', - field=models.ImageField(blank=True, upload_to='carousel_images'), - ), - ] diff --git a/pages/migrations/0017_auto_20190328_1523.py b/pages/migrations/0017_auto_20190328_1523.py deleted file mode 100644 index d92de173c..000000000 --- a/pages/migrations/0017_auto_20190328_1523.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 2.1.5 on 2019-03-28 19:23 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('singletournaments', '0013_auto_20190313_1400'), - ('pages', '0016_auto_20190327_1727'), - ] - - operations = [ - migrations.RemoveField( - model_name='staticinfo', - name='featured_touranment', - ), - migrations.AddField( - model_name='staticinfo', - name='featured_tournament', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='featured_tournament', to='singletournaments.SingleEliminationTournament'), - ), - ] diff --git a/pages/migrations/0018_auto_20190329_1930.py b/pages/migrations/0018_auto_20190329_1930.py deleted file mode 100644 index f1ee36b9c..000000000 --- a/pages/migrations/0018_auto_20190329_1930.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.1.5 on 2019-03-29 23:30 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('pages', '0017_auto_20190328_1523'), - ] - - operations = [ - migrations.AlterField( - model_name='staticinfo', - name='featured_tournament', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='featured_tournament', to='singletournaments.SingleEliminationTournament'), - ), - ] diff --git a/pages/migrations/0018_auto_20190426_1727.py b/pages/migrations/0018_auto_20190426_1727.py deleted file mode 100644 index 0a85f428e..000000000 --- a/pages/migrations/0018_auto_20190426_1727.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 2.1.5 on 2019-04-26 21:27 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - dependencies = [ - ('pages', '0017_auto_20190328_1523'), - ] - - operations = [ - migrations.AlterField( - model_name='staticinfo', - name='featured_tournament', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, - related_name='featured_tournament', - to='singletournaments.SingleEliminationTournament'), - ), - ] diff --git a/pages/migrations/0019_auto_20190523_2257.py b/pages/migrations/0019_auto_20190523_2257.py deleted file mode 100644 index 7be9959eb..000000000 --- a/pages/migrations/0019_auto_20190523_2257.py +++ /dev/null @@ -1,49 +0,0 @@ -# Generated by Django 2.1.7 on 2019-05-24 02:57 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('pages', '0018_auto_20190426_1727'), - ] - - operations = [ - migrations.CreateModel( - name='SocialInfo', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('twitchchannel', models.URLField(blank=True, default='https://www.twitch.tv', null=True, verbose_name='twitch_channel')), - ('youtubechannel', models.URLField(blank=True, default='https://www.youtube.com', null=True, verbose_name='youtube_channel')), - ('twitterprofile', models.URLField(blank=True, default='https://www.twitter.com', null=True, verbose_name='twitter_profile')), - ('facebookpage', models.URLField(blank=True, default='https://www.facebook.com', null=True, verbose_name='facebook_page')), - ('instagrampage', models.URLField(blank=True, default='https://www.instagram.com', null=True, verbose_name='instagram_page')), - ('stream', models.CharField(default='twitch', max_length=25)), - ], - ), - migrations.RemoveField( - model_name='staticinfo', - name='facebookpage', - ), - migrations.RemoveField( - model_name='staticinfo', - name='instagrampage', - ), - migrations.RemoveField( - model_name='staticinfo', - name='stream', - ), - migrations.RemoveField( - model_name='staticinfo', - name='twitchchannel', - ), - migrations.RemoveField( - model_name='staticinfo', - name='twitterprofile', - ), - migrations.RemoveField( - model_name='staticinfo', - name='youtubechannel', - ), - ] diff --git a/pages/migrations/0019_merge_20190605_1915.py b/pages/migrations/0019_merge_20190605_1915.py deleted file mode 100644 index b38906dd6..000000000 --- a/pages/migrations/0019_merge_20190605_1915.py +++ /dev/null @@ -1,14 +0,0 @@ -# Generated by Django 2.2.2 on 2019-06-05 23:15 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('pages', '0018_auto_20190426_1727'), - ('pages', '0018_auto_20190329_1930'), - ] - - operations = [ - ] diff --git a/pages/migrations/0020_auto_20190605_1916.py b/pages/migrations/0020_auto_20190605_1916.py deleted file mode 100644 index 12d1a6940..000000000 --- a/pages/migrations/0020_auto_20190605_1916.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.2.2 on 2019-06-05 23:16 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('pages', '0019_merge_20190605_1915'), - ] - - operations = [ - migrations.AlterField( - model_name='staticinfo', - name='featured_tournament', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='featured_tournament', to='singletournaments.SingleEliminationTournament'), - ), - ] diff --git a/pages/migrations/0021_merge_20190607_1511.py b/pages/migrations/0021_merge_20190607_1511.py deleted file mode 100644 index 25a9ccacb..000000000 --- a/pages/migrations/0021_merge_20190607_1511.py +++ /dev/null @@ -1,14 +0,0 @@ -# Generated by Django 2.2.2 on 2019-06-07 19:11 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('pages', '0020_auto_20190605_1916'), - ('pages', '0019_auto_20190523_2257'), - ] - - operations = [ - ] diff --git a/pages/migrations/0022_auto_20190620_1748.py b/pages/migrations/0022_auto_20190620_1748.py deleted file mode 100644 index 7c06c33b3..000000000 --- a/pages/migrations/0022_auto_20190620_1748.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 2.2.2 on 2019-06-20 21:48 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - dependencies = [ - ('pages', '0021_merge_20190607_1511'), - ] - - operations = [ - migrations.AlterField( - model_name='staticinfo', - name='featured_tournament', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, - related_name='featured_tournament', - to='singletournaments.SingleEliminationTournament'), - ), - ] diff --git a/pages/migrations/0023_auto_20190620_1749.py b/pages/migrations/0023_auto_20190620_1749.py deleted file mode 100644 index acbc724aa..000000000 --- a/pages/migrations/0023_auto_20190620_1749.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 2.2.2 on 2019-06-20 21:49 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - dependencies = [ - ('pages', '0022_auto_20190620_1748'), - ] - - operations = [ - migrations.AlterField( - model_name='staticinfo', - name='featured_tournament', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, - related_name='featured_tournament', - to='singletournaments.SingleEliminationTournament'), - ), - ] diff --git a/pages/migrations/0024_auto_20200108_1654.py b/pages/migrations/0024_auto_20200108_1654.py deleted file mode 100644 index 3138a7919..000000000 --- a/pages/migrations/0024_auto_20200108_1654.py +++ /dev/null @@ -1,141 +0,0 @@ -# Generated by Django 2.2.2 on 2020-01-08 21:54 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('pages', '0023_auto_20190620_1749'), - ] - - operations = [ - migrations.RemoveField( - model_name='staticinfo', - name='bingeslide1big', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingeslide1link', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingeslide1small', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingeslide2big', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingeslide2link', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingeslide2small', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingeslide3big', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingeslide3link', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingeslide3small', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingetop1', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingetop1image', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingetop1link', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingetop1linktxt', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingetop2', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingetop2image', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingetop2link', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingetop2linktxt', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingetop3', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingetop3image', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingetop3link', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingetop3linktxt', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingetop4', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingetop4image', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingetop4link', - ), - migrations.RemoveField( - model_name='staticinfo', - name='bingetop4linktxt', - ), - migrations.RemoveField( - model_name='staticinfo', - name='gatournament1', - ), - migrations.RemoveField( - model_name='staticinfo', - name='gatournament1big', - ), - migrations.RemoveField( - model_name='staticinfo', - name='gatournament1small', - ), - migrations.RemoveField( - model_name='staticinfo', - name='gatournament2', - ), - migrations.RemoveField( - model_name='staticinfo', - name='gatournament2big', - ), - migrations.RemoveField( - model_name='staticinfo', - name='gatournament2small', - ), - migrations.RemoveField( - model_name='staticinfo', - name='gatournamentbig', - ), - ] diff --git a/pages/migrations/0025_auto_20200410_1506.py b/pages/migrations/0025_auto_20200410_1506.py deleted file mode 100644 index f096cf19c..000000000 --- a/pages/migrations/0025_auto_20200410_1506.py +++ /dev/null @@ -1,88 +0,0 @@ -# Generated by Django 2.2.3 on 2020-04-10 19:06 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('pages', '0024_auto_20200108_1654'), - ] - - operations = [ - migrations.AddField( - model_name='staticinfo', - name='block1_img', - field=models.ImageField(blank=True, upload_to='carousel_images'), - ), - migrations.AddField( - model_name='staticinfo', - name='block1link', - field=models.URLField(blank=True, default='https://www.google.com', null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='block1text', - field=models.CharField(blank=True, default='', max_length=50, null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='block2_img', - field=models.ImageField(blank=True, upload_to='carousel_images'), - ), - migrations.AddField( - model_name='staticinfo', - name='block2link', - field=models.URLField(blank=True, default='https://www.google.com', null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='block2text', - field=models.CharField(blank=True, default='', max_length=50, null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='block3_img', - field=models.ImageField(blank=True, upload_to='carousel_images'), - ), - migrations.AddField( - model_name='staticinfo', - name='block3link', - field=models.URLField(blank=True, default='https://www.google.com', null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='block3text', - field=models.CharField(blank=True, default='', max_length=50, null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='slide1header', - field=models.CharField(blank=True, default='', max_length=50, null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='slide1subhead', - field=models.CharField(blank=True, default='', max_length=50, null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='slide2header', - field=models.CharField(blank=True, default='', max_length=50, null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='slide2subhead', - field=models.CharField(blank=True, default='', max_length=50, null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='slide3header', - field=models.CharField(blank=True, default='', max_length=50, null=True), - ), - migrations.AddField( - model_name='staticinfo', - name='slide3subhead', - field=models.CharField(blank=True, default='', max_length=50, null=True), - ), - ] diff --git a/pages/migrations/0026_auto_20200410_1525.py b/pages/migrations/0026_auto_20200410_1525.py deleted file mode 100644 index 3850ea8f8..000000000 --- a/pages/migrations/0026_auto_20200410_1525.py +++ /dev/null @@ -1,46 +0,0 @@ -# Generated by Django 2.2.3 on 2020-04-10 19:25 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('pages', '0025_auto_20200410_1506'), - ] - - operations = [ - migrations.AlterModelOptions( - name='socialinfo', - options={'verbose_name_plural': 'Social info'}, - ), - migrations.AlterModelOptions( - name='staticinfo', - options={'verbose_name_plural': 'Static info'}, - ), - migrations.AlterField( - model_name='socialinfo', - name='facebookpage', - field=models.URLField(blank=True, null=True, verbose_name='facebook_page'), - ), - migrations.AlterField( - model_name='socialinfo', - name='instagrampage', - field=models.URLField(blank=True, null=True, verbose_name='instagram_page'), - ), - migrations.AlterField( - model_name='socialinfo', - name='twitchchannel', - field=models.URLField(blank=True, null=True, verbose_name='twitch_channel'), - ), - migrations.AlterField( - model_name='socialinfo', - name='twitterprofile', - field=models.URLField(blank=True, null=True, verbose_name='twitter_profile'), - ), - migrations.AlterField( - model_name='socialinfo', - name='youtubechannel', - field=models.URLField(blank=True, null=True, verbose_name='youtube_channel'), - ), - ] diff --git a/pages/migrations/0027_auto_20200410_1526.py b/pages/migrations/0027_auto_20200410_1526.py deleted file mode 100644 index ff8c02b14..000000000 --- a/pages/migrations/0027_auto_20200410_1526.py +++ /dev/null @@ -1,53 +0,0 @@ -# Generated by Django 2.2.3 on 2020-04-10 19:26 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('pages', '0026_auto_20200410_1525'), - ] - - operations = [ - migrations.AlterField( - model_name='partner', - name='website', - field=models.URLField(blank=True, null=True), - ), - migrations.AlterField( - model_name='socialinfo', - name='stream', - field=models.CharField(blank=True, max_length=25, null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='block1link', - field=models.URLField(blank=True, null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='block2link', - field=models.URLField(blank=True, null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='block3link', - field=models.URLField(blank=True, null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='slide1link', - field=models.TextField(blank=True, null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='slide2link', - field=models.TextField(blank=True, null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='slide3link', - field=models.TextField(blank=True, null=True), - ), - ] diff --git a/pages/migrations/0028_auto_20200410_1534.py b/pages/migrations/0028_auto_20200410_1534.py deleted file mode 100644 index f904c4ace..000000000 --- a/pages/migrations/0028_auto_20200410_1534.py +++ /dev/null @@ -1,28 +0,0 @@ -# Generated by Django 2.2.3 on 2020-04-10 19:34 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('pages', '0027_auto_20200410_1526'), - ] - - operations = [ - migrations.AlterField( - model_name='staticinfo', - name='slide1link', - field=models.URLField(blank=True, null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='slide2link', - field=models.URLField(blank=True, null=True), - ), - migrations.AlterField( - model_name='staticinfo', - name='slide3link', - field=models.URLField(blank=True, null=True), - ), - ] diff --git a/pages/migrations/0029_auto_20200420_1350.py b/pages/migrations/0029_auto_20200420_1350.py deleted file mode 100644 index b6c73e475..000000000 --- a/pages/migrations/0029_auto_20200420_1350.py +++ /dev/null @@ -1,82 +0,0 @@ -# Generated by Django 2.2.12 on 2020-04-20 17:50 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('pages', '0028_auto_20200410_1534'), - ] - - operations = [ - migrations.CreateModel( - name='FrontPageSlide', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('header', models.CharField(blank=True, default='', max_length=50, null=True)), - ('subhead', models.CharField(blank=True, default='', max_length=100, null=True)), - ('link', models.URLField(blank=True, null=True)), - ('image', models.ImageField(blank=True, upload_to='carousel_images')), - ], - options={ - 'verbose_name_plural': 'Front Page Slides', - }, - ), - migrations.RemoveField( - model_name='staticinfo', - name='slide1_img', - ), - migrations.RemoveField( - model_name='staticinfo', - name='slide1header', - ), - migrations.RemoveField( - model_name='staticinfo', - name='slide1link', - ), - migrations.RemoveField( - model_name='staticinfo', - name='slide1subhead', - ), - migrations.RemoveField( - model_name='staticinfo', - name='slide2_img', - ), - migrations.RemoveField( - model_name='staticinfo', - name='slide2header', - ), - migrations.RemoveField( - model_name='staticinfo', - name='slide2link', - ), - migrations.RemoveField( - model_name='staticinfo', - name='slide2subhead', - ), - migrations.RemoveField( - model_name='staticinfo', - name='slide3_img', - ), - migrations.RemoveField( - model_name='staticinfo', - name='slide3header', - ), - migrations.RemoveField( - model_name='staticinfo', - name='slide3link', - ), - migrations.RemoveField( - model_name='staticinfo', - name='slide3subhead', - ), - migrations.RemoveField( - model_name='staticinfo', - name='welcomeln1', - ), - migrations.RemoveField( - model_name='staticinfo', - name='welcomeln2', - ), - ] diff --git a/profiles/admin.py b/profiles/admin.py index 9a7d8062b..645432668 100644 --- a/profiles/admin.py +++ b/profiles/admin.py @@ -1,6 +1,7 @@ from django.contrib import admin -from profiles.models import UserProfile +from profiles.models import UserProfile, Notification # Register your models here. admin.site.register(UserProfile) +admin.site.register(Notification) diff --git a/profiles/forms.py b/profiles/forms.py index 3cb4e1d1f..eac8eea7c 100644 --- a/profiles/forms.py +++ b/profiles/forms.py @@ -29,9 +29,12 @@ class Meta: fields = ( 'profile_picture', 'about_me', + 'alternate_name', 'xbl', 'psn', 'steam', + 'steamid64', + 'discord', 'epic', 'lol', 'battlenet', @@ -50,6 +53,7 @@ def __init__(self, *args, **kwargs): {'name': 'profile_picture', 'class': 'form-control', 'style': ''}) self.fields['about_me'].widget.attrs.update({'name': 'about_me', 'class': 'form-control', 'style': ''}) self.fields['xbl'].widget.attrs.update({'name': 'xbl', 'class': 'form-control', 'style': ''}) + self.fields['alternate_name'].widget.attrs.update({'name': 'xbl', 'class': 'form-control', 'style': ''}) self.fields['psn'].widget.attrs.update({'name': 'psn', 'class': 'form-control', 'style': ''}) self.fields['steam'].widget.attrs.update({'name': 'steam', 'class': 'form-control', 'style': diff --git a/profiles/migrations/0001_initial.py b/profiles/migrations/0001_initial.py index 8200b78dd..57f361e93 100644 --- a/profiles/migrations/0001_initial.py +++ b/profiles/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.0.5 on 2018-07-03 23:46 +# Generated by Django 2.2.15 on 2020-12-09 20:08 from django.conf import settings from django.db import migrations, models @@ -7,34 +7,28 @@ class Migration(migrations.Migration): + initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('teams', '0001_initial'), ] operations = [ migrations.CreateModel( - name='BannedUser', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('ip', models.CharField(default='error', max_length=12)), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='banned', - to=settings.AUTH_USER_MODEL)), - ], - ), - migrations.CreateModel( - name='UserGear', + name='Notification', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('ownpc', models.BooleanField(default=False)), - ('cpu', models.CharField(default='No CPU specified', max_length=30)), - ('gpu', models.CharField(default='No GPU specified', max_length=30)), - ('psu', models.CharField(default='No PSU specified', max_length=30)), - ('case', models.CharField(default='No Case specified', max_length=30)), - ('os', models.CharField(default='No OS specified', max_length=30)), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='userspecs', - to=settings.AUTH_USER_MODEL)), + ('datetime', models.DateTimeField(auto_created=True)), + ('title', models.CharField(blank=True, max_length=255, null=True)), + ('description', models.TextField(default='No description given')), + ('sender', models.CharField(default='System', max_length=255)), + ('type', models.CharField(choices=[('match', 1), ('tournament', 2), ('league', 3), ('team', 4), ('support', 5), ('news', 6), ('general', 7), ('store', 8)], default='general', max_length=255)), + ('link', models.CharField(max_length=255)), + ('pk1', models.IntegerField(default=0)), + ('read', models.BooleanField(default=False)), + ('seen', models.BooleanField(default=False)), ], ), migrations.CreateModel( @@ -47,32 +41,52 @@ class Migration(migrations.Migration): ('total_earning', models.PositiveSmallIntegerField(default=0)), ('current_earning', models.PositiveSmallIntegerField(default=0)), ('about_me', models.TextField(blank=True, default='Forever a mystery')), + ('steamid64', models.CharField(blank=True, default='No SteamID64', max_length=255)), + ('discord', models.CharField(blank=True, default='No Dsicord', max_length=255)), ('xbl', models.CharField(blank=True, default='No Xbox Live Linked', max_length=30)), ('psn', models.CharField(blank=True, default='No PSN Linked', max_length=30)), ('steam', models.CharField(blank=True, default='No Steam Linked', max_length=30)), + ('epic', models.CharField(blank=True, default='No Epic Linked', max_length=30)), ('lol', models.CharField(blank=True, default='No LOL Linked', max_length=30)), ('battlenet', models.CharField(blank=True, default='No Battle.net Linked', max_length=30)), + ('activisionid', models.CharField(blank=True, default='No Activision ID Linked', max_length=30)), ('twitter_profile', models.CharField(blank=True, default='No Twitter Linked', max_length=30)), ('twitch_channel', models.CharField(blank=True, default='No Twitch Linked', max_length=50)), ('favorite_game', models.CharField(blank=True, default='N/A', max_length=50)), ('favorite_console', models.CharField(blank=True, default='N/A', max_length=50)), ('profile_picture', models.ImageField(blank=True, upload_to='profile_images')), - ('user_type', models.CharField(default='user', max_length=10)), - ('ip', models.CharField(default='0.0.0.0', max_length=16)), + ('user_type', models.CharField(choices=[('user', 'Standard User'), ('admin', 'Admin'), ('superadmin', 'Super Admin')], default='user', max_length=10)), + ('ip', models.CharField(default='0.0.0.0', max_length=45)), ('num_trophies', models.PositiveSmallIntegerField(default=0)), - ('xbl_verified', models.BooleanField(default=False)), + ('xbl_verified', models.BooleanField(blank=True, default=False)), ('psn_verified', models.BooleanField(default=False)), + ('user_verified', models.BooleanField(blank=True, default=False)), ('num_bronze', models.PositiveSmallIntegerField(default=0)), ('num_silver', models.PositiveSmallIntegerField(default=0)), ('num_gold', models.PositiveSmallIntegerField(default=0)), ('num_plat', models.PositiveSmallIntegerField(default=0)), ('num_diamond', models.PositiveSmallIntegerField(default=0)), ('num_titanium', models.PositiveSmallIntegerField(default=0)), + ('num_wagerwin', models.PositiveIntegerField(default=0)), + ('num_wagerloss', models.PositiveIntegerField(default=0)), ('tournament_wins', models.PositiveSmallIntegerField(default=0)), ('dubl_tournament_wins', models.PositiveSmallIntegerField(default=0)), + ('rank', models.PositiveSmallIntegerField(default=100)), ('country', django_countries.fields.CountryField(default='US', max_length=2)), - ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='user', - to=settings.AUTH_USER_MODEL)), + ('email_enabled', models.BooleanField(default=True)), + ('captain_teams', models.ManyToManyField(related_name='profile_captain_teams', to='teams.Team')), + ('founder_teams', models.ManyToManyField(related_name='profile_founder_teams', to='teams.Team')), + ('notifications', models.ManyToManyField(blank=True, related_name='user_notifications', to='profiles.Notification')), + ('player_teams', models.ManyToManyField(related_name='profile_player_teams', to='teams.Team')), + ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='user', to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='BannedUser', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('ip', models.CharField(default='error', max_length=12)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='banned', to=settings.AUTH_USER_MODEL)), ], ), ] diff --git a/profiles/migrations/0002_auto_20180803_1110.py b/profiles/migrations/0002_auto_20180803_1110.py deleted file mode 100644 index 6eeb7c9fb..000000000 --- a/profiles/migrations/0002_auto_20180803_1110.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 2.0.2 on 2018-08-03 15:10 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('profiles', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='userprofile', - name='ip', - field=models.CharField(default='0.0.0.0', max_length=45), - ), - ] diff --git a/profiles/migrations/0002_auto_20201214_1845.py b/profiles/migrations/0002_auto_20201214_1845.py new file mode 100644 index 000000000..6448b46d2 --- /dev/null +++ b/profiles/migrations/0002_auto_20201214_1845.py @@ -0,0 +1,28 @@ +# Generated by Django 2.2.7 on 2020-12-14 23:45 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('profiles', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='userprofile', + name='captain_teams', + field=models.ManyToManyField(blank=True, related_name='profile_captain_teams', to='teams.Team'), + ), + migrations.AlterField( + model_name='userprofile', + name='founder_teams', + field=models.ManyToManyField(blank=True, related_name='profile_founder_teams', to='teams.Team'), + ), + migrations.AlterField( + model_name='userprofile', + name='player_teams', + field=models.ManyToManyField(blank=True, related_name='profile_player_teams', to='teams.Team'), + ), + ] diff --git a/profiles/migrations/0003_userprofile_rank.py b/profiles/migrations/0003_userprofile_alternate_name.py similarity index 50% rename from profiles/migrations/0003_userprofile_rank.py rename to profiles/migrations/0003_userprofile_alternate_name.py index 0e4ce85bf..8c22da21e 100644 --- a/profiles/migrations/0003_userprofile_rank.py +++ b/profiles/migrations/0003_userprofile_alternate_name.py @@ -1,17 +1,18 @@ -# Generated by Django 2.0.1 on 2018-09-14 18:31 +# Generated by Django 2.2.15 on 2021-01-01 17:14 from django.db import migrations, models class Migration(migrations.Migration): + dependencies = [ - ('profiles', '0002_auto_20180803_1110'), + ('profiles', '0002_auto_20201214_1845'), ] operations = [ migrations.AddField( model_name='userprofile', - name='rank', - field=models.PositiveSmallIntegerField(default=100), + name='alternate_name', + field=models.CharField(blank=True, max_length=50, null=True), ), ] diff --git a/profiles/migrations/0004_userprofile_user_verified.py b/profiles/migrations/0004_userprofile_user_verified.py deleted file mode 100644 index 3130b132a..000000000 --- a/profiles/migrations/0004_userprofile_user_verified.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 2.0.8 on 2018-10-08 19:04 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('profiles', '0003_userprofile_rank'), - ] - - operations = [ - migrations.AddField( - model_name='userprofile', - name='user_verified', - field=models.BooleanField(default=False), - ), - ] diff --git a/profiles/migrations/0005_userprofile_epic.py b/profiles/migrations/0005_userprofile_epic.py deleted file mode 100644 index 050c8eda9..000000000 --- a/profiles/migrations/0005_userprofile_epic.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 2.0.5 on 2018-10-13 20:55 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('profiles', '0004_userprofile_user_verified'), - ] - - operations = [ - migrations.AddField( - model_name='userprofile', - name='epic', - field=models.CharField(blank=True, default='No Epic Linked', max_length=30), - ), - ] diff --git a/profiles/migrations/0006_auto_20190207_1944.py b/profiles/migrations/0006_auto_20190207_1944.py deleted file mode 100644 index c1bffb912..000000000 --- a/profiles/migrations/0006_auto_20190207_1944.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.1.5 on 2019-02-08 00:44 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('profiles', '0005_userprofile_epic'), - ] - - operations = [ - migrations.AlterField( - model_name='userprofile', - name='user_verified', - field=models.BooleanField(blank=True, default=False), - ), - migrations.AlterField( - model_name='userprofile', - name='xbl_verified', - field=models.BooleanField(blank=True, default=False), - ), - ] diff --git a/profiles/migrations/0007_userprofile_email_enabled.py b/profiles/migrations/0007_userprofile_email_enabled.py deleted file mode 100644 index 401f6d61e..000000000 --- a/profiles/migrations/0007_userprofile_email_enabled.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 2.1.5 on 2019-02-10 20:05 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('profiles', '0006_auto_20190207_1944'), - ] - - operations = [ - migrations.AddField( - model_name='userprofile', - name='email_enabled', - field=models.BooleanField(default=True), - ), - ] diff --git a/profiles/migrations/0008_auto_20190602_1757.py b/profiles/migrations/0008_auto_20190602_1757.py deleted file mode 100644 index 90d8b6740..000000000 --- a/profiles/migrations/0008_auto_20190602_1757.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.1.5 on 2019-06-02 21:57 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('profiles', '0007_userprofile_email_enabled'), - ] - - operations = [ - migrations.AlterField( - model_name='userprofile', - name='user_type', - field=models.CharField(choices=[('user', 'Standard User'), ('admin', 'Admin'), ('superadmin', 'Super Admin')], default='user', max_length=10), - ), - ] diff --git a/profiles/migrations/0009_auto_20190620_1725.py b/profiles/migrations/0009_auto_20190620_1725.py deleted file mode 100644 index b507a222c..000000000 --- a/profiles/migrations/0009_auto_20190620_1725.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.2.2 on 2019-06-20 21:25 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ('profiles', '0008_auto_20190602_1757'), - ] - - operations = [ - migrations.AddField( - model_name='userprofile', - name='num_wagerloss', - field=models.PositiveIntegerField(default=0), - ), - migrations.AddField( - model_name='userprofile', - name='num_wagerwin', - field=models.PositiveIntegerField(default=0), - ), - ] diff --git a/profiles/migrations/0010_delete_usergear.py b/profiles/migrations/0010_delete_usergear.py deleted file mode 100644 index 134da3b3c..000000000 --- a/profiles/migrations/0010_delete_usergear.py +++ /dev/null @@ -1,16 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-07 18:18 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('profiles', '0009_auto_20190620_1725'), - ] - - operations = [ - migrations.DeleteModel( - name='UserGear', - ), - ] diff --git a/profiles/migrations/0011_userprofile_activisionid.py b/profiles/migrations/0011_userprofile_activisionid.py deleted file mode 100644 index 07ccc86f9..000000000 --- a/profiles/migrations/0011_userprofile_activisionid.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-07 18:19 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('profiles', '0010_delete_usergear'), - ] - - operations = [ - migrations.AddField( - model_name='userprofile', - name='activisionid', - field=models.CharField(blank=True, default='No Activision ID Linked', max_length=30), - ), - ] diff --git a/profiles/models.py b/profiles/models.py index c4bccc51a..cd42d00bb 100644 --- a/profiles/models.py +++ b/profiles/models.py @@ -3,6 +3,32 @@ from django.db.models.signals import post_save from django_countries.fields import CountryField +NOTIFICATION_TYPES = [ + ('match', 1), + ('tournament', 2), + ('league', 3), + ('team', 4), + ('support', 5), + ('news', 6), + ('general', 7), + ('store', 8), +] + + +class Notification(models.Model): + title = models.CharField(max_length=255, null=True, blank=True) + description = models.TextField(default="No description given") + # set the default sender of a notification as "System" + sender = models.CharField(max_length=255, default="System") + type = models.CharField(choices=NOTIFICATION_TYPES, default='general', max_length=255) + datetime = models.DateTimeField(auto_created=True) + link = models.CharField(max_length=255) + pk1 = models.IntegerField(default=0) + # has the user marked the notification as read? default to false + read = models.BooleanField(default=False) + # has the user visited the notification list page since the notification was generated? used for stats + seen = models.BooleanField(default=False) + class UserProfile(models.Model): def __str__(self): @@ -10,8 +36,11 @@ def __str__(self): # associate the userprofile with the django user user = models.OneToOneField(User, related_name='user', on_delete=models.CASCADE) + alternate_name = models.CharField(blank=True, null=True, max_length=50) # xp they have from winning events xp = models.PositiveSmallIntegerField(default=0) + # all notifications associated with this user + notifications = models.ManyToManyField(Notification, related_name='user_notifications', blank=True) # credits they own from purchasing things in the store credits = models.PositiveSmallIntegerField(default=0) passes = models.PositiveSmallIntegerField(default=0) @@ -19,6 +48,8 @@ def __str__(self): total_earning = models.PositiveSmallIntegerField(default=0) current_earning = models.PositiveSmallIntegerField(default=0) about_me = models.TextField(default='Forever a mystery', blank=True) + steamid64 = models.CharField(max_length=255, default='No SteamID64', blank=True) + discord = models.CharField(max_length=255, default='No Dsicord', blank=True) xbl = models.CharField(max_length=30, default='No Xbox Live Linked', blank=True) psn = models.CharField(max_length=30, default='No PSN Linked', blank=True) steam = models.CharField(max_length=30, default='No Steam Linked', blank=True) @@ -63,6 +94,12 @@ def __str__(self): country = CountryField(blank_label='(select country)', default='US') email_enabled = models.BooleanField(default=True) + # teams the user founded + founder_teams = models.ManyToManyField('teams.Team', related_name='profile_founder_teams', blank=True) + # teams the user is a captain of + captain_teams = models.ManyToManyField('teams.Team', related_name='profile_captain_teams', blank=True) + # teams the user is a player on + player_teams = models.ManyToManyField('teams.Team', related_name='profile_player_teams', blank=True) def calculate_rank(self): self.rank = int(UserProfile.objects.filter(xp__gt=self.xp).count()) + 1 diff --git a/profiles/urls.py b/profiles/urls.py index 5cc232e9b..ab8fa930f 100644 --- a/profiles/urls.py +++ b/profiles/urls.py @@ -13,4 +13,7 @@ path('users/search/', login_required(views.searchusers), name='searchusers'), path('user//', views.profile, name='profile'), path('leaderboards/', views.LeaderboardView.as_view(), name='leaderboard'), + path('notifications/', login_required(views.notifications_list), name='notifications'), + path('notifications//read/', login_required(views.notification_read), name='notification_read'), + path('notifications//unread/', login_required(views.notification_unread), name='notification_unread'), ] diff --git a/profiles/views.py b/profiles/views.py index 7778c7584..fa6a01819 100644 --- a/profiles/views.py +++ b/profiles/views.py @@ -1,5 +1,6 @@ import requests from django.conf import settings +from django.core.exceptions import ObjectDoesNotExist from django.contrib import messages from django.contrib.auth import login as auth_login, REDIRECT_FIELD_NAME, logout as auth_logout, get_user_model from django.contrib.auth.forms import AuthenticationForm, PasswordResetForm, SetPasswordForm @@ -15,10 +16,9 @@ from django.utils.encoding import force_bytes, force_text from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode, is_safe_url from django.views.generic import View - from teams.models import TeamInvite from .forms import CreateUserForm, EditProfileForm, SortForm -from .models import UserProfile +from .models import UserProfile, Notification from .tokens import account_activation_token @@ -44,7 +44,7 @@ def login(request, template_name='profiles/login_form.html', r = requests.post('https://www.google.com/recaptcha/api/siteverify', data=data) result = r.json() - + ''' End reCAPTCHA validation''' if result['success']: if not request.POST.get('remember me', None): @@ -263,8 +263,8 @@ def searchusers(request): if query: return render(request, 'profiles/users.html', {'userprofiles': UserProfile.objects.filter - (Q(user__username__icontains=query) | Q(user__email__icontains=query) | - Q(psn__icontains=query) | Q(xbl__icontains=query))}) + (Q(user__username__icontains=query) | Q(user__email__icontains=query) | + Q(psn__icontains=query) | Q(xbl__icontains=query))}) else: return redirect('profiles:users') @@ -363,8 +363,8 @@ def post(self, request): def activate(request, uidb64, token): try: uid = force_text(urlsafe_base64_decode(uidb64)) - #a = uidb64.split("'")[1] - #uid = urlsafe_base64_decode(a).decode() + # a = uidb64.split("'")[1] + # uid = urlsafe_base64_decode(a).decode() user = User.objects.get(pk=uid) except(TypeError, ValueError, OverflowError, User.DoesNotExist) as e: print("Exception") @@ -426,3 +426,39 @@ def post(self, request, **kwargs): messages.error(request, 'No sort option selected, sorting by descending xp') return render(request, 'teams/leaderboard.html', {'user_list': user_list, 'form': self.form_class(None)}) + + +def notifications_list(request): + if request.user.is_anonymous: + messages.error('You must be signed in to view your notifications', request) + return redirect('index') + else: + profile = UserProfile.objects.get(user=request.user) + notifications = profile.notifications.all() + notifications = notifications.filter(read=False) + read = profile.notifications.all().filter(read=True) + for x in profile.notifications.all(): + x.seen = True + x.save() + return render(request, 'profiles/notifications_list.html', + {'profile': profile, 'notifications': notifications, 'read': read}) + + +def notification_read(request, pk): + try: + notif = Notification.objects.get(pk=pk) + notif.read = True + notif.save() + except ObjectDoesNotExist: + messages.error(request, 'Error marking notification as read') + return redirect('profiles:notifications') + + +def notification_unread(request, pk): + try: + notif = Notification.objects.get(pk=pk) + notif.read = False + notif.save() + except ObjectDoesNotExist: + messages.error(request, 'Error marking notification as unread') + return redirect('profiles:notifications') \ No newline at end of file diff --git a/project-static/css/olly.css b/project-static/css/olly.css index 24d3244f2..5852c0116 100644 --- a/project-static/css/olly.css +++ b/project-static/css/olly.css @@ -1,3 +1,45 @@ +/* The alert message box */ +.warning { + padding: 20px; + background: orange; + /* background-color: #f44336; /* Red */ + color: white; + margin-bottom: 15px; +} + +.success { + padding: 20px; + background: green; + /* background-color: #f44336; /* Red */ + color: white; + margin-bottom: 15px; +} + +.error { + padding: 20px; + background: #f44336; + /* background-color: #f44336; /* Red */ + color: white; + margin-bottom: 15px; +} + +/* The close button */ +.closebtn { + margin-left: 15px; + color: white; + font-weight: bold; + float: right; + font-size: 22px; + line-height: 20px; + cursor: pointer; + transition: 0.3s; +} + +/* When moving the mouse over the close button */ +.closebtn:hover { + color: black; +} + /* Sticky footer styles -------------------------------------------------- */ html { diff --git a/project-static/fontawesome5.0.4/webfonts/fa-brands-400.ttf b/project-static/fontawesome5.0.4/webfonts/fa-brands-400.ttf new file mode 100644 index 000000000..937b33bd8 Binary files /dev/null and b/project-static/fontawesome5.0.4/webfonts/fa-brands-400.ttf differ diff --git a/project-static/fontawesome5.0.4/webfonts/fa-brands-400.woff b/project-static/fontawesome5.0.4/webfonts/fa-brands-400.woff new file mode 100644 index 000000000..f7323ad38 Binary files /dev/null and b/project-static/fontawesome5.0.4/webfonts/fa-brands-400.woff differ diff --git a/project-static/fontawesome5.0.4/webfonts/fa-brands-400.woff2 b/project-static/fontawesome5.0.4/webfonts/fa-brands-400.woff2 new file mode 100644 index 000000000..9a54f6de5 Binary files /dev/null and b/project-static/fontawesome5.0.4/webfonts/fa-brands-400.woff2 differ diff --git a/project-static/images/gamepad-solid.svg b/project-static/images/gamepad-solid.svg new file mode 100644 index 000000000..216acf533 --- /dev/null +++ b/project-static/images/gamepad-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/project-static/images/trophy-solid.svg b/project-static/images/trophy-solid.svg new file mode 100644 index 000000000..543ed2271 --- /dev/null +++ b/project-static/images/trophy-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/project-templates/base.html b/project-templates/base.html index ffc12c855..5f1ffc58c 100644 --- a/project-templates/base.html +++ b/project-templates/base.html @@ -34,7 +34,7 @@ - Project Olly (DEV BUILD) + {{ SITE_NAME }} {% endblock %} \ No newline at end of file diff --git a/project-templates/staff/singletournaments/singletournament_create.html b/project-templates/staff/singletournaments/singletournament_create.html index 88c6e7263..5d33c0724 100644 --- a/project-templates/staff/singletournaments/singletournament_create.html +++ b/project-templates/staff/singletournaments/singletournament_create.html @@ -50,14 +50,14 @@

Return to tournament list

- + {{ form.open_register }}
- + {{ form.close_register }}
diff --git a/project-templates/staff/singletournaments/singletournament_detail.html b/project-templates/staff/singletournaments/singletournament_detail.html index f375d6e69..68d7ecea5 100644 --- a/project-templates/staff/singletournaments/singletournament_detail.html +++ b/project-templates/staff/singletournaments/singletournament_detail.html @@ -10,6 +10,7 @@

Back to Tournament list

+

-- Current UTC Time {{ time }}

diff --git a/project-templates/staff/singletournaments/singletournament_edit.html b/project-templates/staff/singletournaments/singletournament_edit.html index 7554881e5..03da26d1a 100644 --- a/project-templates/staff/singletournaments/singletournament_edit.html +++ b/project-templates/staff/singletournaments/singletournament_edit.html @@ -29,6 +29,7 @@ {% endfor %} {% endif %}

Return to tournament list

+

Current UTC Time {{ time }}

{% csrf_token %} diff --git a/project-templates/staff/singletournaments/singletournament_list.html b/project-templates/staff/singletournaments/singletournament_list.html index 5a1cae65b..0ec31991a 100644 --- a/project-templates/staff/singletournaments/singletournament_list.html +++ b/project-templates/staff/singletournaments/singletournament_list.html @@ -8,9 +8,7 @@ {% block body %}
-

Always lower the size of a tournament to the lowest possible amount - BEFORE launching -
- This will prevent the system from making a lot of extra byes.

+

Current UTC Time {{ time }}

Create a ruleset

diff --git a/project-templates/staff/staffbase.html b/project-templates/staff/staffbase.html index aa9e16793..e58e5df8e 100644 --- a/project-templates/staff/staffbase.html +++ b/project-templates/staff/staffbase.html @@ -259,12 +259,14 @@ --> - + {% if STORE_ENABLED %} + + {% endif %}