Merge branch 'tobast/issue15' into 'master'

Tobast/issue15

Fix #15 : ajout d'un champ 'image' dans le modèle Event, ajout du support de ImageField.

See merge request !55
This commit is contained in:
Martin Pepin 2016-07-10 11:00:04 +02:00
commit 42e5a90fe7
5 changed files with 38 additions and 1 deletions

1
.gitignore vendored
View file

@ -7,3 +7,4 @@ settings.py
venv/
.vagrant
/src
media/

View file

@ -116,6 +116,12 @@ USE_TZ = True
STATIC_URL = '/static/'
# Media upload (through ImageField, SiteField)
# https://docs.djangoproject.com/en/1.9/ref/models/fields/
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
MEDIA_URL = '/media/'
# Various additional settings
SITE_ID = 1

View file

@ -1,4 +1,8 @@
# -*-coding:utf-8 -*
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
import autocomplete_light
@ -69,4 +73,9 @@ urlpatterns = patterns(
url(r'^utile_bda/bda_diff$', 'gestioncof.views.liste_bdadiff'),
url(r'^utile_cof/diff_cof$', 'gestioncof.views.liste_diffcof'),
url(r'^utile_bda/bda_revente$', 'gestioncof.views.liste_bdarevente'),
)
) + \
(static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
if settings.DEBUG
else [])
# Si on est en production, MEDIA_ROOT est servi par Apache.
# Il faut dire à Django de servir MEDIA_ROOT lui-même en développement.

View file

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gestioncof', '0002_enable_unprocessed_demandes'),
]
operations = [
migrations.AddField(
model_name='event',
name='image',
field=models.ImageField(upload_to=b'imgs/events/', null=True, verbose_name=b'Image', blank=True),
),
]

View file

@ -105,6 +105,8 @@ class Event(models.Model):
start_date = models.DateField("Date de début", blank=True, null=True)
end_date = models.DateField("Date de fin", blank=True, null=True)
description = models.TextField("Description", blank=True)
image = models.ImageField("Image", blank=True, null=True,
upload_to="imgs/events/")
registration_open = models.BooleanField("Inscriptions ouvertes",
default=True)
old = models.BooleanField("Archiver (événement fini)", default=False)