-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c92e9c0
commit 097b720
Showing
6 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import re | ||
|
||
from django import template | ||
from django.shortcuts import resolve_url | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.filter | ||
def get_search_page(request): | ||
if request.path in ["/users/", "/users"]: | ||
return resolve_url("user_list") | ||
elif match := re.fullmatch(r"^/contest/([^/]+)/scoreboard/organization/([^/]+$)", request.path): | ||
return resolve_url( | ||
"contest_organization_scoreboard", contest_slug=match.group(1), org_slug=match.group(2) | ||
) | ||
elif match := re.fullmatch(r"^/contest/([^/]+)/scoreboard$", request.path): | ||
return resolve_url("contest_scoreboard", slug=match.group(1)) | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% load search %} | ||
|
||
<form method="GET" action="{{ request|get_search_page }}"> | ||
<div class="input-group mb-3"> | ||
<input type="text" class="form-control" placeholder="Search" name="q" value="{{ request.GET.search }}"> | ||
<div class="input-group-append"> | ||
<button class="btn btn-outline-secondary" | ||
style="border-bottom-left-radius: 0; border-top-left-radius: 0" type="submit">Search | ||
</button> | ||
</div> | ||
</div> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters