Compare commits

..

No commits in common. "46ea80161db19de6f3ff7fb9fb292aac3a6cba26" and "ff657c070a6869cf95955952b828156b4d7470a8" have entirely different histories.

4 changed files with 29 additions and 8 deletions

View File

@ -14,6 +14,6 @@ class Migration(migrations.Migration):
migrations.AddField( migrations.AddField(
model_name='event', model_name='event',
name='campus', name='campus',
field=models.ManyToManyField(blank=True, to='accounts.Campus'), field=models.ManyToManyField(blank=True, null=True, to='accounts.Campus'),
), ),
] ]

View File

@ -0,0 +1,19 @@
# Generated by Django 3.2.11 on 2022-05-30 07:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0011_migration_campus'),
('events', '0010_event_campus'),
]
operations = [
migrations.AlterField(
model_name='event',
name='campus',
field=models.ManyToManyField(blank=True, to='accounts.Campus'),
),
]

View File

@ -3,6 +3,7 @@ from django.contrib.auth.models import User
from django.contrib.auth.models import timezone from django.contrib.auth.models import timezone
import uuid import uuid
from accounts.models import Campus from accounts.models import Campus
from scoreboard.views import campus
# Create your models here. # Create your models here.
class Event(models.Model): class Event(models.Model):

View File

@ -1,3 +1,4 @@
from pprint import pprint
from django.shortcuts import render, get_object_or_404, redirect from django.shortcuts import render, get_object_or_404, redirect
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import timezone from django.contrib.auth.models import timezone
@ -110,6 +111,13 @@ def event(request, event_slug):
player = None player = None
if player: if player:
IsRegistered = True IsRegistered = True
if event_info.password:
if request.user.is_authenticated:
if request.user.is_staff is False:
if not player:
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': True, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered, 'userHasCampus': True, 'campusCanJoin': True})
else:
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': False, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered, 'userHasCampus': True, 'campusCanJoin': True})
if event_info.campus.all(): if event_info.campus.all():
if request.user.is_authenticated: if request.user.is_authenticated:
if request.user.is_staff is False: if request.user.is_staff is False:
@ -120,13 +128,6 @@ def event(request, event_slug):
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': True, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered, 'userHasCampus': True, 'campusCanJoin': False}) return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': True, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered, 'userHasCampus': True, 'campusCanJoin': False})
else: else:
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': False, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered, 'userHasCampus': True, 'campusCanJoin': True}) return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': False, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered, 'userHasCampus': True, 'campusCanJoin': True})
if event_info.password:
if request.user.is_authenticated:
if request.user.is_staff is False:
if not player:
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': True, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered, 'userHasCampus': True, 'campusCanJoin': True})
else:
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': False, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered, 'userHasCampus': True, 'campusCanJoin': True})
ended = False ended = False
if timezone.now() >= event_info.end_date: if timezone.now() >= event_info.end_date:
ended = True ended = True