This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/limits
- Loading branch information
Showing
13 changed files
with
346 additions
and
106 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
from django.forms import CharField, Form, Textarea | ||
from django.forms import Form | ||
from djangocodemirror.fields import CodeMirrorField | ||
|
||
|
||
class SubmissionForm(Form): | ||
code = CharField( | ||
label="Source Code", | ||
required=True, | ||
code = CodeMirrorField( | ||
min_length=15, | ||
widget=Textarea(attrs={"rows": 12, "style": "width: 100%;"}), | ||
label="Code", | ||
required=True, | ||
config_name="python", | ||
) |
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
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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
from django.urls import path | ||
|
||
from apps.users.views import ProfileView, RegisterView | ||
from apps.users.views import ProfileView, RankingView, RegisterView | ||
|
||
app_name = "users" | ||
|
||
urlpatterns = [ | ||
path("register/", RegisterView.as_view(), name="register"), | ||
path("profile/<str:username>/", ProfileView.as_view(), name="profile"), | ||
path("ranking/", RankingView.as_view(), name="ranking"), | ||
] |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,96 @@ | ||
{% extends "base.html" %} | ||
|
||
{% load crispy_forms_tags %} | ||
|
||
{% block title %}Ranking{% endblock title %} | ||
|
||
{% block head %} | ||
<style> | ||
.center-table { | ||
display: flex; | ||
justify-content: center; | ||
} | ||
table { | ||
border-collapse: collapse; | ||
width: 100%; | ||
margin: 20px 0; | ||
} | ||
th, td { | ||
border: 1px solid #dddddd; | ||
text-align: left; | ||
padding: 8px; | ||
text-align: center; | ||
} | ||
th { | ||
background-color: #f2f2f2; | ||
} | ||
</style> | ||
{% endblock head %} | ||
|
||
{% block content %} | ||
<h2>Ranking</h2> | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>Rank</th> | ||
<th>User</th> | ||
<th>Score</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for user in page_obj %} | ||
<tr> | ||
<td>{{ forloop.counter }}</td> | ||
<td> | ||
<a href="{% url 'users:profile' user.username %}"> | ||
{{ user.username }} | ||
</a> | ||
</td> | ||
<td>{{ user.score }}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
|
||
<nav aria-label="Page navigation example"> | ||
<ul class="pagination"> | ||
{% if page_obj.has_previous %} | ||
<li class="page-item"> | ||
<a class="page-link" href="?page=1" tabindex="-1">First</a> | ||
</li> | ||
<li class="page-item"> | ||
<a class="page-link" href="?page={{ page_obj.previous_page_number }}">Previous</a> | ||
</li> | ||
{% else %} | ||
<li class="page-item disabled"> | ||
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">Previous</a> | ||
</li> | ||
{% endif %} | ||
|
||
{% for i in page_obj.paginator.page_range %} | ||
{% if page_obj.number == i %} | ||
<li class="page-item active"> | ||
<a class="page-link" href="?page={{ i }}">{{ i }} </a> | ||
</li> | ||
{% else %} | ||
<li class="page-item"> | ||
<a class="page-link" href="?page={{ i }}">{{ i }}</a> | ||
</li> | ||
{% endif %} | ||
{% endfor %} | ||
|
||
{% if page_obj.has_next %} | ||
<li class="page-item"> | ||
<a class="page-link" href="?page={{ page_obj.next_page_number }}">Next</a> | ||
</li> | ||
<li class="page-item"> | ||
<a class="page-link" href="?page={{ page_obj.paginator.num_pages }}">Last</a> | ||
</li> | ||
{% else %} | ||
<li class="page-item disabled"> | ||
<a class="page-link" href="#" aria-disabled="true">Next</a> | ||
</li> | ||
{% endif %} | ||
</ul> | ||
</nav> | ||
{% endblock content %} |
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