From 2337a249974fa064427ac9dc2026d74222d96a0c Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sun, 15 Apr 2018 19:09:12 +0200 Subject: [PATCH 1/2] Fix #106 --- preferences/templates/preferences/preferences.html | 2 +- preferences/views.py | 4 ++-- re2o/settings.py | 6 +++++- re2o/templates/re2o/index.html | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/preferences/templates/preferences/preferences.html b/preferences/templates/preferences/preferences.html index 16d7a74d..e8972d8d 100644 --- a/preferences/templates/preferences/preferences.html +++ b/preferences/templates/preferences/preferences.html @@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% endif %} -
+ {% csrf_token %} {% if preferenceform %} {% bootstrap_form preferenceform %} diff --git a/preferences/views.py b/preferences/views.py index f7838281..3393aa75 100644 --- a/preferences/views.py +++ b/preferences/views.py @@ -119,7 +119,7 @@ def edit_options(request, section): @can_create(Service) def add_service(request): """Ajout d'un service de la page d'accueil""" - service = ServiceForm(request.POST or None) + service = ServiceForm(request.POST or None, request.FILES or None) if service.is_valid(): with transaction.atomic(), reversion.create_revision(): service.save() @@ -138,7 +138,7 @@ def add_service(request): @can_edit(Service) def edit_service(request, service_instance, **_kwargs): """Edition des services affichés sur la page d'accueil""" - service = ServiceForm(request.POST or None, instance=service_instance) + service = ServiceForm(request.POST or None, request.FILES or None,instance=service_instance) if service.is_valid(): with transaction.atomic(), reversion.create_revision(): service.save() diff --git a/re2o/settings.py b/re2o/settings.py index 3e937483..b68738dd 100644 --- a/re2o/settings.py +++ b/re2o/settings.py @@ -155,7 +155,11 @@ BOOTSTRAP_BASE_URL = '/static/bootstrap/' STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static').replace('\\', '/'), ) -# Directory where the static files serverd by the server are stored + +MEDIA_ROOT = '/var/www/re2o/media' + +MEDIA_URL = '/media/' + STATIC_ROOT = os.path.join(BASE_DIR, 'static_files') # The URL to access the static files STATIC_URL = '/static/' diff --git a/re2o/templates/re2o/index.html b/re2o/templates/re2o/index.html index 25eec921..e3b17e0a 100644 --- a/re2o/templates/re2o/index.html +++ b/re2o/templates/re2o/index.html @@ -37,7 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% for service in service_list %}
- {{ service.name }} + {{ service.name }}

{{ service.name }}

{{ service.description }}

From 98eae9563266cb762d7b7684c895f18597d906ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Kervella?= Date: Sun, 15 Apr 2018 17:26:28 +0000 Subject: [PATCH 2/2] Avoid duplicate settings and keeps comments --- re2o/settings.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/re2o/settings.py b/re2o/settings.py index b68738dd..bac8982b 100644 --- a/re2o/settings.py +++ b/re2o/settings.py @@ -155,16 +155,14 @@ BOOTSTRAP_BASE_URL = '/static/bootstrap/' STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static').replace('\\', '/'), ) - -MEDIA_ROOT = '/var/www/re2o/media' - -MEDIA_URL = '/media/' - +# Directory where the static files served by the server are stored STATIC_ROOT = os.path.join(BASE_DIR, 'static_files') # The URL to access the static files STATIC_URL = '/static/' -# Directory where the media files serverd by the server are stored +# Directory where the media files served by the server are stored MEDIA_ROOT = os.path.join(BASE_DIR, 'media').replace('\\', '/') +# The URL to access the static files +MEDIA_URL = '/media/' # Models to use for graphs GRAPH_MODELS = {