From b01ed31e450f4a4cd3242f7de1e36169aca88820 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 29 Feb 2020 13:04:03 +0100 Subject: [PATCH] Design the page --- templates/base.html | 57 ---------------------------------------- templates/tombola.html | 44 ++++++++++++++++++++++++------- tombola/settings/base.py | 3 +++ tombola/urls.py | 7 ++++- 4 files changed, 43 insertions(+), 68 deletions(-) diff --git a/templates/base.html b/templates/base.html index a6be725..3986a1f 100644 --- a/templates/base.html +++ b/templates/base.html @@ -56,26 +56,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
-
{% block contenttitle %}

{{ title }}

{% endblock %} {% block content %} @@ -83,43 +63,6 @@ SPDX-License-Identifier: GPL-3.0-or-later {% endblock content %}
- {% block extrajavascript %} {% endblock extrajavascript %} diff --git a/templates/tombola.html b/templates/tombola.html index f73bca6..31aea4b 100644 --- a/templates/tombola.html +++ b/templates/tombola.html @@ -7,16 +7,40 @@ {% endblock %} {% block content %} - Old: - {% for reward in old_rewards %} - {{ reward.name }} (won by {{ previous_reward.rewarded_by.note }}, ticket n°{{ previous_reward.rewarded_by.number }})
- {% endfor %} - Previous: {{ previous_reward.name }} (won by {{ previous_reward.rewarded_by.note }}, ticket n°{{ previous_reward.rewarded_by.number }})
- Current: {{ current_reward.name }}
- Next: - {% for reward in next_rewards %} - {{ reward.name }}
- {% endfor %} +
+
+ Lots déjà offerts : +
    + {% for reward in old_rewards %} +
  • {{ reward.name }} : remporté par {{ reward.rewarded_by.note }} (ticket n° {{ reward.rewarded_by.number }})
  • + {% endfor %} +
+
+ +
+ Lot précédent :
+ {{ previous_reward.name }} : remporté par {{ previous_reward.rewarded_by.note }} + (ticket n° {{ previous_reward.rewarded_by.number }})
+ + {{ previous_reward.name }} +
+ +
+ Lot suivant :
+ {{ current_reward.name }}
+ + {{ previous_reward.name }} +
+ +
+ Lots à venir : +
    + {% for reward in next_rewards %} +
  • {{ reward.name }}
  • + {% endfor %} +
+
+
{% endblock %} {% block extrajavascript %} diff --git a/tombola/settings/base.py b/tombola/settings/base.py index 5fd68c2..530a765 100644 --- a/tombola/settings/base.py +++ b/tombola/settings/base.py @@ -166,6 +166,9 @@ STATIC_ROOT = os.path.realpath(__file__) STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static')] +MEDIA_ROOT = os.path.join(BASE_DIR, 'media') +MEDIA_URL = '/media/' + CRISPY_TEMPLATE_PACK = 'bootstrap4' DJANGO_TABLES2_TEMPLATE = 'django_tables2/bootstrap4.html' # URL prefix for static files. diff --git a/tombola/urls.py b/tombola/urls.py index 126ed1d..8af7feb 100644 --- a/tombola/urls.py +++ b/tombola/urls.py @@ -15,8 +15,10 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ - +from . import settings from django.contrib import admin +from django.contrib.staticfiles.urls import static +from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.urls import path, include urlpatterns = [ @@ -25,3 +27,6 @@ urlpatterns = [ path('admin/', admin.site.urls), path('', include('tbde.urls')), ] + +urlpatterns += staticfiles_urlpatterns() +urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)