From 891c2530e6e7e55359265115be8ce91b3065e24a Mon Sep 17 00:00:00 2001 From: zero Date: Fri, 19 Aug 2022 15:43:25 +0200 Subject: [PATCH 1/3] Podium added and working, logo and website of campuses added in campus model --- .../migrations/0013_auto_20220818_1741.py | 25 +++++++ .../migrations/0014_auto_20220818_1744.py | 23 +++++++ src/accounts/models.py | 2 + .../templates/scoreboard/network.html | 65 +++++++++++++----- .../templates/scoreboard/scoreboard.html | 68 +++++++++---------- src/scoreboard/views.py | 5 +- src/statics/css/style.css | 17 +++++ src/templates/base.html | 2 +- 8 files changed, 154 insertions(+), 53 deletions(-) create mode 100644 src/accounts/migrations/0013_auto_20220818_1741.py create mode 100644 src/accounts/migrations/0014_auto_20220818_1744.py 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/scoreboard/templates/scoreboard/network.html b/src/scoreboard/templates/scoreboard/network.html index 1d876d5..2a6862f 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 %} +
+
+ +

#2 :

+

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

+
+
+ +

#1 :

+

+ Score : {{ top3.0.1 }} +
+ {{ top3.0.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 }}