forked from DGNum/gestioCOF
Merge branch 'kerl/refactor_events' into 'master'
Nouvelle app pour gérer les événements See merge request klub-dev-ens/gestioCOF!365
This commit is contained in:
commit
e9ca8eb8dd
11 changed files with 121 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
* Le FUTUR !
|
||||
|
||||
- Nouveau module de gestion des événements (début d'implem, désactivé en prod)
|
||||
|
||||
* Version 0.3 - ???
|
||||
|
||||
- Un peu de pub pour KDEns sur la page d'accueil
|
||||
- Fix erreur 500 sur /bda/revente/<tirage_id>/manage
|
||||
- Si on essaie d'accéder au compte que qqn d'autre on a une 404 (et plus une 403)
|
||||
|
|
|
@ -15,6 +15,10 @@ DEBUG = True
|
|||
if TESTING:
|
||||
PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]
|
||||
|
||||
# Only in development mode as long as the events app is not
|
||||
# ready for production
|
||||
INSTALLED_APPS += ["events"]
|
||||
|
||||
|
||||
# ---
|
||||
# Apache static/media config
|
||||
|
|
|
@ -6,12 +6,14 @@ The settings that are not listed here are imported from .common
|
|||
import os
|
||||
|
||||
from .common import * # NOQA
|
||||
from .common import BASE_DIR, import_secret
|
||||
from .common import BASE_DIR, INSTALLED_APPS, TESTING, import_secret
|
||||
|
||||
DEBUG = False
|
||||
|
||||
ALLOWED_HOSTS = ["cof.ens.fr", "www.cof.ens.fr", "dev.cof.ens.fr"]
|
||||
|
||||
if TESTING:
|
||||
INSTALLED_APPS.append("events")
|
||||
|
||||
STATIC_ROOT = os.path.join(
|
||||
os.path.dirname(os.path.dirname(BASE_DIR)), "public", "gestion", "static"
|
||||
|
|
0
events/__init__.py
Normal file
0
events/__init__.py
Normal file
4
events/admin.py
Normal file
4
events/admin.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
from django.contrib import admin
|
||||
from events.models import Event
|
||||
|
||||
admin.site.register(Event)
|
5
events/apps.py
Normal file
5
events/apps.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class EventsConfig(AppConfig):
|
||||
name = "events"
|
67
events/migrations/0001_event.py
Normal file
67
events/migrations/0001_event.py
Normal file
|
@ -0,0 +1,67 @@
|
|||
# Generated by Django 2.2.6 on 2019-10-05 12:28
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="Event",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("title", models.CharField(max_length=200, verbose_name="titre")),
|
||||
("location", models.CharField(max_length=200, verbose_name="lieu")),
|
||||
(
|
||||
"start_date",
|
||||
models.DateTimeField(
|
||||
blank=True, null=True, verbose_name="date de début"
|
||||
),
|
||||
),
|
||||
(
|
||||
"end_date",
|
||||
models.DateTimeField(
|
||||
blank=True, null=True, verbose_name="date de fin"
|
||||
),
|
||||
),
|
||||
(
|
||||
"description",
|
||||
models.TextField(blank=True, verbose_name="description"),
|
||||
),
|
||||
(
|
||||
"image",
|
||||
models.ImageField(
|
||||
blank=True,
|
||||
null=True,
|
||||
upload_to="imgs/events/",
|
||||
verbose_name="image",
|
||||
),
|
||||
),
|
||||
(
|
||||
"registration_open",
|
||||
models.BooleanField(
|
||||
default=True, verbose_name="inscriptions ouvertes"
|
||||
),
|
||||
),
|
||||
(
|
||||
"old",
|
||||
models.BooleanField(
|
||||
default=False, verbose_name="archiver (événement fini)"
|
||||
),
|
||||
),
|
||||
],
|
||||
options={"verbose_name": "événement", "verbose_name_plural": "événements"},
|
||||
)
|
||||
]
|
0
events/migrations/__init__.py
Normal file
0
events/migrations/__init__.py
Normal file
31
events/models.py
Normal file
31
events/models.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
class Event(models.Model):
|
||||
title = models.CharField(_("titre"), max_length=200)
|
||||
location = models.CharField(_("lieu"), max_length=200)
|
||||
start_date = models.DateTimeField(_("date de début"), blank=True, null=True)
|
||||
end_date = models.DateTimeField(_("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)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("événement")
|
||||
verbose_name_plural = _("événements")
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
|
||||
# TODO: gérer les inscriptions
|
||||
|
||||
# TODO: gérer les options (EventOption & EventOptionChoice de gestioncof)
|
||||
# par exemple: "option végé au Mega (oui / non)"
|
||||
|
||||
# TODO: gérer les champs commentaires (EventCommentField & EventCommentChoice)
|
||||
# par exemple: "champ "allergies / régime particulier" au Mega
|
0
events/views.py
Normal file
0
events/views.py
Normal file
|
@ -2,6 +2,7 @@
|
|||
source =
|
||||
bda
|
||||
cof
|
||||
events
|
||||
gestioncof
|
||||
kfet
|
||||
petitscours
|
||||
|
|
Loading…
Reference in a new issue