diff --git a/src/accounts/migrations/0013_auto_20220818_1741.py b/src/accounts/migrations/0013_auto_20220818_1741.py new file mode 100644 index 0000000..b31aa86 --- /dev/null +++ b/src/accounts/migrations/0013_auto_20220818_1741.py @@ -0,0 +1,25 @@ +# Generated by Django 3.2.11 on 2022-08-18 15:41 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0012_auto_20220801_2212'), + ] + + operations = [ + migrations.AddField( + model_name='campus', + name='logo', + field=models.URLField(default='https://42.fr'), + preserve_default=False, + ), + migrations.AddField( + model_name='campus', + name='url', + field=models.URLField(default='https://42.fr', max_length=100), + preserve_default=False, + ), + ] diff --git a/src/accounts/migrations/0014_auto_20220818_1744.py b/src/accounts/migrations/0014_auto_20220818_1744.py new file mode 100644 index 0000000..6d375cb --- /dev/null +++ b/src/accounts/migrations/0014_auto_20220818_1744.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.11 on 2022-08-18 15:44 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0013_auto_20220818_1741'), + ] + + operations = [ + migrations.AlterField( + model_name='campus', + name='logo', + field=models.URLField(blank=True), + ), + migrations.AlterField( + model_name='campus', + name='url', + field=models.URLField(blank=True, max_length=100), + ), + ] diff --git a/src/accounts/models.py b/src/accounts/models.py index 0514306..21d49a0 100644 --- a/src/accounts/models.py +++ b/src/accounts/models.py @@ -28,6 +28,8 @@ class UserProfileInfo(models.Model): class Campus(models.Model): id = models.IntegerField(primary_key=True, unique=True) name = models.CharField(max_length=50) + url = models.URLField(max_length=100,blank=True) + logo = models.URLField(max_length=200,blank=True) def __str__(self): return self.name class Meta: diff --git a/src/ctfs/templatetags/get_chall.py b/src/ctfs/templatetags/get_chall.py index 9d5b335..d1be5be 100644 --- a/src/ctfs/templatetags/get_chall.py +++ b/src/ctfs/templatetags/get_chall.py @@ -4,9 +4,7 @@ register = template.Library() @register.simple_tag def get_chall_by_lang(chall, lang): - print(chall.slug) filepath = "ctfs/templates/challenges/"+ lang + "/" + chall.slug + ".html" - print(filepath) try: with open(filepath) as fp: return fp.read() diff --git a/src/scoreboard/templates/scoreboard/network.html b/src/scoreboard/templates/scoreboard/network.html index 1d876d5..002458e 100644 --- a/src/scoreboard/templates/scoreboard/network.html +++ b/src/scoreboard/templates/scoreboard/network.html @@ -2,28 +2,61 @@ {% load i18n %} {% block content %}
+
+

{% trans "42Network Scoreboard" %}

+
-
-

Scoreboard

- - - - - - - - - - {% for name, score in scores.items %} +
+
+ {{ top3.1.0 }} +

#2 :

+

+ Score : {{ top3.1.1 }} +
+ {{ top3.1.0 }} +

+
+
+ {{ top3.0.0 }} +

#1 :

+

+ Score : {{ top3.0.1 }} +
+ {{ top3.0.0 }} +

+
+
+ {{ top3.2.0 }} +

#3 :

+

+ Score : {{ top3.2.1 }} +
+ {{ top3.2.0 }} +

+
+
+ +
+
{% trans "Rank" %}{% trans "Campus" %}{% trans "Score" %}
+ + + + + + + + + {% for name, score in scores.items %} + {% if forloop.counter0 > 2 %} - {% endfor %} - -
{% trans "Rank" %}{% trans "Campus" %}{% trans "Score" %}
# {{ forloop.counter0|add:1 }} {{ name }} {{ score}}
-
+ {% endif %} + {% endfor %} + +
{% endblock %} diff --git a/src/scoreboard/templates/scoreboard/scoreboard.html b/src/scoreboard/templates/scoreboard/scoreboard.html index a993320..aa18524 100644 --- a/src/scoreboard/templates/scoreboard/scoreboard.html +++ b/src/scoreboard/templates/scoreboard/scoreboard.html @@ -4,43 +4,43 @@ {% load is_member %}
-

{% trans "Scoreboard" %}

+

{% trans "Global Scoreboard" %}

+ + + + + + + + + + + + {% for s in scores %} + {% ismember s.user.userprofileinfo as is_member %} + + + + + + + + {% endfor %} + +
{% trans "Rank" %}{% trans "Username" %}{% trans "Website" %}{% trans "Campus" %}{% trans "Score" %}
# {{ forloop.counter0|add:scores.start_index }} {{ s.user.username }} + {% if s.user.userprofileinfo.portfolio_site %} + {{ s.user.userprofileinfo.portfolio_site }} + {% endif %} + + {% if s.user.userprofileinfo.campus %} + + {{ s.user.userprofileinfo.campus }} + + {% endif %} + {{ s.user.userprofileinfo.score }}
- - - - - - - - - - - - {% for s in scores %} - {% ismember s.user.userprofileinfo as is_member %} - - - - - - - - {% endfor %} - -
{% trans "Rank" %}{% trans "Username" %}{% trans "Website" %}{% trans "Campus" %}{% trans "Score" %}
# {{ forloop.counter0|add:scores.start_index }} {{ s.user.username }} - {% if s.user.userprofileinfo.portfolio_site %} - {{ s.user.userprofileinfo.portfolio_site }} - {% endif %} - - {% if s.user.userprofileinfo.campus %} - - {{ s.user.userprofileinfo.campus }} - - {% endif %} - {{ s.user.userprofileinfo.score }}