mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-25 22:22:26 +00:00
Merge branch 'fix_upload_img' into 'master'
Fix #106 Closes #106 See merge request federez/re2o!132
This commit is contained in:
commit
6c6422aff3
4 changed files with 8 additions and 6 deletions
|
@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endif %}
|
||||
|
||||
|
||||
<form class="form" method="post">
|
||||
<form class="form" method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{% if preferenceform %}
|
||||
{% bootstrap_form preferenceform %}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -155,12 +155,14 @@ 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
|
||||
# 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 = {
|
||||
|
|
|
@ -37,7 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% for service in service_list %}
|
||||
<div class="col-12">
|
||||
<div class="thumbnail">
|
||||
<a href="{{ service.url }}"><img src="{% static service.image %}" alt="{{ service.name }}"></a>
|
||||
<a href="{{ service.url }}"><img src="{{ service.image.url }}" alt="{{ service.name }}"></a>
|
||||
<div class="caption">
|
||||
<h3>{{ service.name }}</h3>
|
||||
<p>{{ service.description }}</p>
|
||||
|
|
Loading…
Reference in a new issue