Compare commits

..

3 Commits

Author SHA1 Message Date
Starthur 46ea80161d Chack campus before password 2022-05-31 22:14:11 +02:00
Starthur d222784bb0 Remove unsued import 2022-05-31 22:13:54 +02:00
Starthur 86fbf93dbf Remove a useless migration 2022-05-31 22:13:45 +02:00
4 changed files with 8 additions and 29 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, null=True, to='accounts.Campus'), field=models.ManyToManyField(blank=True, to='accounts.Campus'),
), ),
] ]

View File

@ -1,19 +0,0 @@
# 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,7 +3,6 @@ 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,4 +1,3 @@
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
@ -111,13 +110,6 @@ 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:
@ -128,6 +120,13 @@ 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