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:
commit
42e5a90fe7
5 changed files with 38 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -7,3 +7,4 @@ settings.py
|
||||||
venv/
|
venv/
|
||||||
.vagrant
|
.vagrant
|
||||||
/src
|
/src
|
||||||
|
media/
|
||||||
|
|
|
@ -116,6 +116,12 @@ USE_TZ = True
|
||||||
|
|
||||||
STATIC_URL = '/static/'
|
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
|
# Various additional settings
|
||||||
SITE_ID = 1
|
SITE_ID = 1
|
||||||
|
|
||||||
|
|
11
cof/urls.py
11
cof/urls.py
|
@ -1,4 +1,8 @@
|
||||||
|
# -*-coding:utf-8 -*
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.conf.urls import patterns, include, url
|
from django.conf.urls import patterns, include, url
|
||||||
|
from django.conf.urls.static import static
|
||||||
|
|
||||||
import autocomplete_light
|
import autocomplete_light
|
||||||
|
|
||||||
|
@ -69,4 +73,9 @@ urlpatterns = patterns(
|
||||||
url(r'^utile_bda/bda_diff$', 'gestioncof.views.liste_bdadiff'),
|
url(r'^utile_bda/bda_diff$', 'gestioncof.views.liste_bdadiff'),
|
||||||
url(r'^utile_cof/diff_cof$', 'gestioncof.views.liste_diffcof'),
|
url(r'^utile_cof/diff_cof$', 'gestioncof.views.liste_diffcof'),
|
||||||
url(r'^utile_bda/bda_revente$', 'gestioncof.views.liste_bdarevente'),
|
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.
|
||||||
|
|
19
gestioncof/migrations/0003_event_image.py
Normal file
19
gestioncof/migrations/0003_event_image.py
Normal 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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -105,6 +105,8 @@ class Event(models.Model):
|
||||||
start_date = models.DateField("Date de début", blank=True, null=True)
|
start_date = models.DateField("Date de début", blank=True, null=True)
|
||||||
end_date = models.DateField("Date de fin", blank=True, null=True)
|
end_date = models.DateField("Date de fin", blank=True, null=True)
|
||||||
description = models.TextField("Description", blank=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",
|
registration_open = models.BooleanField("Inscriptions ouvertes",
|
||||||
default=True)
|
default=True)
|
||||||
old = models.BooleanField("Archiver (événement fini)", default=False)
|
old = models.BooleanField("Archiver (événement fini)", default=False)
|
||||||
|
|
Loading…
Reference in a new issue