diff --git a/hackathon/tests/test_views.py b/hackathon/tests/test_views.py
index 03470366..23e8a4c8 100644
--- a/hackathon/tests/test_views.py
+++ b/hackathon/tests/test_views.py
@@ -227,17 +227,17 @@ def test_list_partner_hackathons(self):
self.client.force_login(self.user)
self.assertTrue(num_hackathons <= 5)
- response = self.client.get(reverse('hackathon:hackathon-list'))
+ response = self.client.get(reverse('hackathon:list-hackathons'))
hackathons = [hackathon.id for hackathon in response.context['hackathons']]
self.assertTrue(hackathon.id not in hackathons)
self.client.force_login(self.staff_user)
- response = self.client.get(reverse('hackathon:hackathon-list'))
+ response = self.client.get(reverse('hackathon:list-hackathons'))
hackathons = [hackathon.id for hackathon in response.context['hackathons']]
self.assertTrue(hackathon.id in hackathons)
self.client.force_login(self.super_user)
- response = self.client.get(reverse('hackathon:hackathon-list'))
+ response = self.client.get(reverse('hackathon:list-hackathons'))
hackathons = [hackathon.id for hackathon in response.context['hackathons']]
self.assertTrue(hackathon.id in hackathons)
@@ -245,7 +245,7 @@ def test_list_partner_hackathons(self):
hackathon.save()
self.client.force_login(self.user)
- response = self.client.get(reverse('hackathon:hackathon-list'))
+ response = self.client.get(reverse('hackathon:list-hackathons'))
hackathons = [hackathon.id for hackathon in response.context['hackathons']]
self.assertTrue(hackathon.id in hackathons)
@@ -255,6 +255,6 @@ def test_list_partner_hackathons(self):
self.user.save()
self.client.force_login(self.user)
- response = self.client.get(reverse('hackathon:hackathon-list'))
+ response = self.client.get(reverse('hackathon:list-hackathons'))
hackathons = [hackathon.id for hackathon in response.context['hackathons']]
self.assertTrue(hackathon.id in hackathons)
diff --git a/hackathon/urls.py b/hackathon/urls.py
index 6b411629..46210e95 100644
--- a/hackathon/urls.py
+++ b/hackathon/urls.py
@@ -22,7 +22,7 @@
urlpatterns = [
- path('', list_hackathons, name="hackathon-list"),
+ path('', list_hackathons, name="list-hackathons"),
path("/team//judging/",
judging, name="judging"),
path("/final_score/", check_projects_scores,
diff --git a/hackathon/views.py b/hackathon/views.py
index fdea951d..33712650 100644
--- a/hackathon/views.py
+++ b/hackathon/views.py
@@ -88,7 +88,7 @@ def list_hackathons(request):
@can_access([UserType.SUPERUSER, UserType.STAFF, UserType.FACILITATOR_ADMIN,
UserType.FACILITATOR_JUDGE, UserType.PARTNER_ADMIN,
UserType.PARTNER_JUDGE],
- redirect_url='hackathon:hackathon-list')
+ redirect_url='hackathon:list-hackathons')
def judging(request, hackathon_id, team_id):
"""Displays the judging page for the judge to save their scores
for the selected project - determined by hackathon id and team id"""
@@ -172,7 +172,7 @@ def judging(request, hackathon_id, team_id):
@login_required
@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN,
- UserType.PARTNER_ADMIN], redirect_url='hackathon:hackathon-list')
+ UserType.PARTNER_ADMIN], redirect_url='hackathon:list-hackathons')
def check_projects_scores(request, hackathon_id):
""" When a judge submits the score, check if all projects in the Hackathon
were scored by all the judges in all the categories by comparing the
@@ -242,7 +242,7 @@ def check_projects_scores(request, hackathon_id):
@login_required
@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN,
- UserType.PARTNER_ADMIN], redirect_url='hackathon:hackathon-list')
+ UserType.PARTNER_ADMIN], redirect_url='hackathon:list-hackathons')
def create_hackathon(request):
""" Allow users to create hackathon event """
if request.method == 'GET':
@@ -300,12 +300,12 @@ def create_hackathon(request):
logger.exception(form.errors)
messages.error(request, ("An error occurred creating the event. "
"Please try again."))
- return redirect("hackathon:hackathon-list")
+ return redirect("hackathon:list-hackathons")
@login_required
@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN,
- UserType.PARTNER_ADMIN], redirect_url='hackathon:hackathon-list')
+ UserType.PARTNER_ADMIN], redirect_url='hackathon:list-hackathons')
def update_hackathon(request, hackathon_id):
""" Allow users to edit hackathon event """
hackathon = get_object_or_404(Hackathon, pk=hackathon_id)
@@ -351,12 +351,12 @@ def update_hackathon(request, hackathon_id):
else:
messages.error(request, ("An error occurred updating the event. "
"Please try again."))
- return redirect("hackathon:hackathon-list")
+ return redirect("hackathon:list-hackathons")
@login_required
@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN,
- UserType.PARTNER_ADMIN], redirect_url='hackathon:hackathon-list')
+ UserType.PARTNER_ADMIN], redirect_url='hackathon:list-hackathons')
def update_hackathon_status(request, hackathon_id):
""" Allows users to updated the status of a hackathon """
if request.method == 'POST':
@@ -369,7 +369,7 @@ def update_hackathon_status(request, hackathon_id):
else:
messages.error(request, ("An error occurred updating the event "
"status. Please try again."))
- return redirect("hackathon:hackathon-list")
+ return redirect("hackathon:list-hackathons")
@login_required
@@ -424,7 +424,7 @@ def view_hackathon_public(request, hackathon_id):
@login_required
@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN,
- UserType.PARTNER_ADMIN], redirect_url='hackathon:hackathon-list')
+ UserType.PARTNER_ADMIN], redirect_url='hackathon:list-hackathons')
def delete_hackathon(request, hackathon_id):
""" Allow users to 'soft delete' hackathon event - set status to 'deleted'
to remove from frontend list """
@@ -437,7 +437,7 @@ def delete_hackathon(request, hackathon_id):
messages.success(
request, f'{hackathon.display_name} has been successfully deleted!')
- return redirect("hackathon:hackathon-list")
+ return redirect("hackathon:list-hackathons")
@login_required
@@ -484,7 +484,7 @@ def enroll_toggle(request):
@login_required
@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN,
- UserType.PARTNER_ADMIN], redirect_url='hackathon:hackathon-list')
+ UserType.PARTNER_ADMIN], redirect_url='hackathon:list-hackathons')
def change_awards(request, hackathon_id):
hackathon = get_object_or_404(Hackathon, pk=hackathon_id)
awards = hackathon.awards.all()
@@ -536,7 +536,7 @@ def change_awards(request, hackathon_id):
@can_access([UserType.SUPERUSER, UserType.STAFF, UserType.FACILITATOR_ADMIN,
UserType.FACILITATOR_JUDGE, UserType.PARTNER_ADMIN,
UserType.PARTNER_JUDGE],
- redirect_url='hackathon:hackathon-list')
+ redirect_url='hackathon:list-hackathons')
def judge_teams(request, hackathon_id):
""" Shows the list of teams and allows a judge to go to the scoring
page """
@@ -554,7 +554,7 @@ def judge_teams(request, hackathon_id):
@login_required
@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN,
- UserType.PARTNER_ADMIN], redirect_url='hackathon:hackathon-list')
+ UserType.PARTNER_ADMIN], redirect_url='hackathon:list-hackathons')
def assign_mentors(request, hackathon_id):
""" View used to assign a mentor to each team """
hackathon = get_object_or_404(Hackathon, id=hackathon_id)
@@ -589,7 +589,7 @@ def assign_mentors(request, hackathon_id):
@login_required
-@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN, UserType.PARTNER_ADMIN], redirect_url='hackathon:hackathon-list')
+@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN, UserType.PARTNER_ADMIN], redirect_url='hackathon:list-hackathons')
def hackathon_events(request, hackathon_id):
hackathon = get_object_or_404(Hackathon, pk=hackathon_id)
events = Event.objects.filter(hackathon=hackathon)
@@ -604,7 +604,7 @@ def hackathon_events(request, hackathon_id):
@login_required
-@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN, UserType.PARTNER_ADMIN], redirect_url='hackathon:hackathon-list')
+@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN, UserType.PARTNER_ADMIN], redirect_url='hackathon:list-hackathons')
def hackathon_events_endpoint(request, hackathon_id):
hackathon = get_object_or_404(Hackathon, pk=hackathon_id)
events = Event.objects.filter(hackathon=hackathon)
@@ -621,7 +621,7 @@ def hackathon_events_endpoint(request, hackathon_id):
@login_required
-@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN, UserType.PARTNER_ADMIN], redirect_url='hackathon:hackathon-list')
+@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN, UserType.PARTNER_ADMIN], redirect_url='hackathon:list-hackathons')
def change_event(request, hackathon_id, event_id=None):
hackathon = get_object_or_404(Hackathon, pk=hackathon_id)
event = get_object_or_404(Event, pk=event_id) if event_id else None
@@ -646,7 +646,7 @@ def change_event(request, hackathon_id, event_id=None):
})
@login_required
-@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN, UserType.PARTNER_ADMIN], redirect_url='hackathon:hackathon-list')
+@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN, UserType.PARTNER_ADMIN], redirect_url='hackathon:list-hackathons')
def delete_event(request, hackathon_id, event_id):
event = get_object_or_404(Event, pk=event_id)
event.delete()
diff --git a/home/templates/home/index.html b/home/templates/home/index.html
index 587178c0..295b246a 100644
--- a/home/templates/home/index.html
+++ b/home/templates/home/index.html
@@ -6,7 +6,7 @@
{% block content %}
-
+
@@ -25,7 +25,7 @@
{% for hackathon in recent_hackathons %}
{% include 'includes/hackathon_square.html' %}
{% endfor %}
- {% include 'includes/link_square.html' with label="See All Hackathons" redirect_url="hackathon:hackathon-list" %}
+ {% include 'includes/link_square.html' with label="See All Hackathons" redirect_url="hackathon:list-hackathons" %}
{% endif %}
diff --git a/home/views.py b/home/views.py
index 1d74091d..733b8fdc 100644
--- a/home/views.py
+++ b/home/views.py
@@ -22,7 +22,7 @@ def index(request):
user's full name is present, if it is not redirect to edit profile,
otherwise redirect to home
"""
- if not request.user.current_lms_module:
+ if not request.user.status:
messages.warning(request, 'Please fill in your profile.')
return redirect(reverse('edit_profile'))
diff --git a/profiles/templates/profiles/profile.html b/profiles/templates/profiles/profile.html
index eb0e6a63..d4194223 100644
--- a/profiles/templates/profiles/profile.html
+++ b/profiles/templates/profiles/profile.html
@@ -71,9 +71,13 @@
{% if user.about %}{{ user.about }}{% else %}N/A{% endif %}
diff --git a/scripts/docker_seed.sh b/scripts/docker_seed.sh
index 0eff5ea1..f2195afa 100755
--- a/scripts/docker_seed.sh
+++ b/scripts/docker_seed.sh
@@ -1,7 +1,9 @@
echo "============================"
echo "Seeding fixtures"
echo "============================"
+docker-compose exec hackathon-app python3 manage.py loaddata groups
docker compose exec hackathon-app python3 manage.py loaddata organisation
+docker-compose exec hackathon-app python3 manage.py loaddata statuses
docker compose exec hackathon-app python3 manage.py loaddata accounts
docker compose exec hackathon-app python3 manage.py loaddata resources
docker compose exec hackathon-app python3 manage.py loaddata profiles
@@ -10,3 +12,4 @@ docker compose exec hackathon-app python3 manage.py loaddata hackathons
docker compose exec hackathon-app python3 manage.py loaddata showcase
docker compose exec hackathon-app python3 manage.py loaddata showcase_site_settings
docker compose exec hackathon-app python3 manage.py loaddata reviews
+
diff --git a/scripts/seed.bat b/scripts/seed.bat
index a0cbcb78..1136e072 100644
--- a/scripts/seed.bat
+++ b/scripts/seed.bat
@@ -1,5 +1,7 @@
ECHO Seeding fixtures
+python manage.py loaddata groups
python manage.py loaddata organisation
+python manage.py loaddata statuses
python manage.py loaddata accounts
python manage.py loaddata resources
python manage.py loaddata profiles
diff --git a/scripts/seed.sh b/scripts/seed.sh
index 54f546d6..a7f31c97 100755
--- a/scripts/seed.sh
+++ b/scripts/seed.sh
@@ -1,7 +1,9 @@
echo "============================"
echo "Seeding fixtures"
echo "============================"
+python3 manage.py loaddata groups
python3 manage.py loaddata organisation
+python3 manage.py loaddata statuses
python3 manage.py loaddata accounts
python3 manage.py loaddata resources
python3 manage.py loaddata profiles
diff --git a/static/css/home.css b/static/css/home.css
index 446ab8db..670895f8 100644
--- a/static/css/home.css
+++ b/static/css/home.css
@@ -1,10 +1,16 @@
.container.main-content-shadow {
- margin-bottom: 0;
margin: 0;
+ margin-top: 32px;
width: 100%;
max-width: none;
}
+.alert {
+ margin: 0 auto;
+ margin-bottom: 10px;
+ max-width: 1140px
+}
+
.hack-card {
margin-bottom: 1rem;
}
diff --git a/teams/helpers.py b/teams/helpers.py
index b7109acc..978cd327 100644
--- a/teams/helpers.py
+++ b/teams/helpers.py
@@ -5,7 +5,6 @@
import pytz
-from .lists import LMS_LEVELS
from accounts.models import CustomUser
from hackathon.models import Hackathon, HackTeam
@@ -73,8 +72,7 @@ def group_participants(participants, num_teams):
participant_groups = {}
hackathon_level = 0
for participant in participants:
- participant_level = (LMS_LEVELS.get(participant.current_lms_module)
- or 1)
+ participant_level = participant.get_level()
hackathon_level += participant_level
participant_groups.setdefault(participant_level, [])
participant_groups[participant_level].append(
@@ -116,8 +114,9 @@ def find_all_combinations(participants, team_sizes):
Returns a list of tuples representing all the possible combinations """
num_teams = len(team_sizes)
- participant_levels = [LMS_LEVELS.get(participant.current_lms_module) or 1
- for participant in participants]
+ participant_levels = [
+ (participant.status.level or 1) if participant.status else 1
+ for participant in participants]
hackathon_level = sum(participant_levels)
team_level = math.floor(hackathon_level / num_teams)
missing = hackathon_level - (num_teams * team_level)
diff --git a/teams/tests.py b/teams/tests.py
index 49ef1649..9ce714fa 100644
--- a/teams/tests.py
+++ b/teams/tests.py
@@ -17,9 +17,9 @@
class TeamsHelpersTestCase(TestCase):
def setUp(self):
call_command('loaddata', 'organisation', verbosity=0)
+ call_command('loaddata', 'statuses', verbosity=0)
call_command('loaddata', 'accounts', verbosity=0)
call_command('loaddata', 'resources', verbosity=0)
- call_command('loaddata', 'profiles', verbosity=0)
call_command('loaddata', 'emailaddresses', verbosity=0)
call_command('loaddata', 'hackathons', verbosity=0)
@@ -136,9 +136,9 @@ def test_create_teams_in_view(self):
class TeamsViewsTestCase(TestCase):
def setUp(self):
call_command('loaddata', 'organisation', verbosity=0)
+ call_command('loaddata', 'statuses', verbosity=0)
call_command('loaddata', 'accounts', verbosity=0)
call_command('loaddata', 'resources', verbosity=0)
- call_command('loaddata', 'profiles', verbosity=0)
call_command('loaddata', 'emailaddresses', verbosity=0)
call_command('loaddata', 'hackathons', verbosity=0)
diff --git a/teams/views.py b/teams/views.py
index 10d2c5de..2b3284dc 100644
--- a/teams/views.py
+++ b/teams/views.py
@@ -30,7 +30,7 @@
@login_required
@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN,
UserType.PARTNER_ADMIN],
- redirect_url='hackathon:hackathon-list')
+ redirect_url='hackathon:list-hackathons')
def change_teams(request, hackathon_id):
""" Page that handles the logic of automatically distributing the teams
for a hackathon and allows for the admin to re-arrange the team members """
@@ -83,7 +83,7 @@ def change_teams(request, hackathon_id):
@login_required
@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN,
UserType.PARTNER_ADMIN],
- redirect_url='hackathon:hackathon-list')
+ redirect_url='hackathon:list-hackathons')
def create_teams(request):
""" View used to save the hackathon teams created by an admin """
if request.method == 'POST':
@@ -104,13 +104,13 @@ def create_teams(request):
return redirect(reverse('hackathon:change_teams',
kwargs={'hackathon_id': hackathon_id}))
else:
- return redirect(reverse('hackathon:hackathon-list'))
+ return redirect(reverse('hackathon:list-hackathons'))
@login_required
@can_access([UserType.SUPERUSER, UserType.FACILITATOR_ADMIN,
UserType.PARTNER_ADMIN],
- redirect_url='hackathon:hackathon-list')
+ redirect_url='hackathon:list-hackathons')
def clear_teams(request):
""" Reset all teams for a specific hackathon """
if request.method == 'POST':
@@ -122,7 +122,7 @@ def clear_teams(request):
return redirect(reverse('hackathon:change_teams',
kwargs={'hackathon_id': hackathon_id}))
else:
- return redirect(reverse('hackathon:hackathon-list'))
+ return redirect(reverse('hackathon:list-hackathons'))
@login_required
diff --git a/templates/base.html b/templates/base.html
index 1fd72675..537752b5 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -30,7 +30,7 @@
- {% if request.user.is_authenticated and not request.user.current_lms_module %}
+ {% if request.user.is_authenticated and not request.user.status %}
You have not entered what part of the programme you are currently at. Please go to your profile and add it
so we can make sure that there is a fair distribution of experience amongst hackathon teams.
diff --git a/templates/faq.html b/templates/faq.html
index 37a9e64c..888653f4 100644
--- a/templates/faq.html
+++ b/templates/faq.html
@@ -69,7 +69,7 @@
You can do that either from the start page, the
- View Hackathons page
+ View Hackathons page
or (if you have a direct link) from the detail view of the hackathon directly;
simply click on the "Enroll as participant" button when
the registration is open.
@@ -80,7 +80,7 @@
Find the hackathon you want to check if you are registered to
diff --git a/templates/includes/navbar.html b/templates/includes/navbar.html
index 84c0b34f..9a81fe8b 100644
--- a/templates/includes/navbar.html
+++ b/templates/includes/navbar.html
@@ -25,12 +25,12 @@