Skip to content

Commit

Permalink
Updating url name and all references to it
Browse files Browse the repository at this point in the history
  • Loading branch information
stefdworschak committed Oct 11, 2021
1 parent 00b6a08 commit 4bf0f5a
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 31 deletions.
12 changes: 6 additions & 6 deletions hackadmin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@login_required
@can_access([UserType.SUPERUSER, UserType.STAFF, UserType.FACILITATOR_ADMIN,
UserType.PARTNER_ADMIN],
redirect_url='hackathon:hackathon-list')
redirect_url='hackathon:list-hackathons')
def hackadmin_panel(request):
""" Used for admin to view all registered users and allows to filter
by individual hackathon """
Expand All @@ -32,7 +32,7 @@ def hackadmin_panel(request):
@login_required
@can_access([UserType.SUPERUSER, UserType.STAFF, UserType.FACILITATOR_ADMIN,
UserType.PARTNER_ADMIN],
redirect_url='hackathon:hackathon-list')
redirect_url='hackathon:list-hackathons')
def hackathon_participants(request, hackathon_id):
""" Used for admin to view all registered users and allows to filter
by individual hackathon """
Expand Down Expand Up @@ -65,7 +65,7 @@ def hackathon_participants(request, hackathon_id):
@login_required
@can_access([UserType.SUPERUSER, UserType.STAFF, UserType.FACILITATOR_ADMIN,
UserType.PARTNER_ADMIN],
redirect_url='hackathon:hackathon-list')
redirect_url='hackathon:list-hackathons')
def all_users(request):
""" Used for admin to view all registered users and allows to filter
by individual hackathon """
Expand All @@ -82,7 +82,7 @@ def all_users(request):
@login_required
@can_access([UserType.SUPERUSER, UserType.STAFF, UserType.FACILITATOR_ADMIN,
UserType.PARTNER_ADMIN],
redirect_url='hackathon:hackathon-list')
redirect_url='hackathon:list-hackathons')
def remove_participant(request, hackathon_id):
if request.method == 'POST':
remove_from_hackathon = (request.POST.get('remove_from_hackathon')
Expand Down Expand Up @@ -111,7 +111,7 @@ def remove_participant(request, hackathon_id):
@login_required
@can_access([UserType.SUPERUSER, UserType.STAFF, UserType.FACILITATOR_ADMIN,
UserType.PARTNER_ADMIN],
redirect_url='hackathon:hackathon-list')
redirect_url='hackathon:list-hackathons')
def add_participant(request, hackathon_id):
if request.method == 'POST':
hackathon = get_object_or_404(Hackathon, id=hackathon_id)
Expand All @@ -129,7 +129,7 @@ def add_participant(request, hackathon_id):
@login_required
@can_access([UserType.SUPERUSER, UserType.STAFF, UserType.FACILITATOR_ADMIN,
UserType.PARTNER_ADMIN],
redirect_url='hackathon:hackathon-list')
redirect_url='hackathon:list-hackathons')
def add_judge(request):
if request.method == 'POST':
hackathon = get_object_or_404(Hackathon,
Expand Down
2 changes: 1 addition & 1 deletion hackathon/templates/hackathon/create-event.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ <h1>Create Hackathon</h1>
</div>
<div class="col-12 mb-5">
<input type="submit" class="btn-ci mr-2">
<a href="{% url 'hackathon:hackathon-list' %}" type="button" class="btn-ci button">Cancel</a>
<a href="{% url 'hackathon:list-hackathons' %}" type="button" class="btn-ci button">Cancel</a>
</div>
</div>
</form>
Expand Down
2 changes: 1 addition & 1 deletion hackathon/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from teams.views import change_teams

urlpatterns = [
path('', list_hackathons, name="hackathon-list"),
path('', list_hackathons, name="list-hackathons"),
path("<int:hackathon_id>/team/<int:team_id>/judging/",
judging, name="judging"),
path("<int:hackathon_id>/final_score/", check_projects_scores,
Expand Down
26 changes: 13 additions & 13 deletions hackathon/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,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"""
Expand Down Expand Up @@ -142,7 +142,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
Expand Down Expand Up @@ -212,7 +212,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':
Expand Down Expand Up @@ -265,12 +265,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)
Expand Down Expand Up @@ -316,12 +316,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':
Expand All @@ -334,7 +334,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
Expand Down Expand Up @@ -383,7 +383,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 """
Expand All @@ -396,7 +396,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
Expand Down Expand Up @@ -438,7 +438,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()
Expand Down Expand Up @@ -490,7 +490,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 """
Expand All @@ -508,7 +508,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)
Expand Down
4 changes: 2 additions & 2 deletions home/templates/home/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{% block content %}

<div class="row mt-5 mb-0">
<div class="row mt-0 mb-0">
<div class="col">

<div class="container mb-5">
Expand All @@ -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" %}
</div>
{% endif %}

Expand Down
4 changes: 2 additions & 2 deletions teams/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,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)

Expand Down Expand Up @@ -134,9 +134,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)

Expand Down
4 changes: 2 additions & 2 deletions teams/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def create_teams(request):
return redirect(reverse('hackathon:view_hackathon',
kwargs={'hackathon_id': hackathon_id}))
else:
return redirect(reverse('hackathon:hackathon-list'))
return redirect(reverse('hackathon:list-hackathons'))


@login_required
Expand All @@ -115,7 +115,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
Expand Down
4 changes: 2 additions & 2 deletions templates/faq.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ <h3 class="mt-5">
</p>
<p>
You can do that either from the start page, the
<a href="{% url 'hackathon:hackathon-list' %}">View Hackathons</a> page
<a href="{% url 'hackathon:list-hackathons' %}">View Hackathons</a> page
or (if you have a direct link) from the detail view of the hackathon directly;
simply click on the <strong>"Enroll as participant"</strong> button when
the registration is open.
Expand All @@ -80,7 +80,7 @@ <h3 class="mt-5">
<p>
<ol>
<li>
Log in and go to the <a href="{% url 'hackathon:hackathon-list' %}">View Hackathons</a> page
Log in and go to the <a href="{% url 'hackathon:list-hackathons' %}">View Hackathons</a> page
</li>
<li>
Find the hackathon you want to check if you are registered to
Expand Down
4 changes: 2 additions & 2 deletions templates/includes/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
<div class="dropdown-menu" aria-labelledby="navbarHackathons">
<!-- TODO: Separate between different admin users -->
<a class="dropdown-item" href="{% url 'hackathon:create_hackathon' %}">Create Hackathon</a>
<a class="dropdown-item" href="{% url 'hackathon:hackathon-list' %}">View Hackathons</a>
<a class="dropdown-item" href="{% url 'hackathon:list-hackathons' %}">View Hackathons</a>
</div>
</li>
{% else %}
<li class="nav-item">
<a class="nav-link" href="{% url 'hackathon:hackathon-list' %}">Hackathons</a>
<a class="nav-link" href="{% url 'hackathon:list-hackathons' %}">Hackathons</a>
</li>
{% endif %}
{% if user.is_authenticated %}
Expand Down

0 comments on commit 4bf0f5a

Please sign in to comment.