Skip to content
Snippets Groups Projects
Commit ce2c2358 authored by Dorian Lesbre's avatar Dorian Lesbre
Browse files

More detailed activities and better display

parent 040a38ec
No related branches found
No related tags found
No related merge requests found
...@@ -7,11 +7,28 @@ class InterludesActivity(models.Model): ...@@ -7,11 +7,28 @@ class InterludesActivity(models.Model):
"""une activité des interludes (i.e. JDR, murder)...""" """une activité des interludes (i.e. JDR, murder)..."""
title = models.CharField("Titre", max_length=200) title = models.CharField("Titre", max_length=200)
duration = models.DurationField("Durée", help_text="format hh:mm:ss") duration = models.DurationField("Durée", help_text="format hh:mm:ss")
max_participants = models.PositiveIntegerField(
"Nombre maximum de participants", help_text="0 pour illimité"
)
min_paricipants = models.PositiveIntegerField(
"Nombre minimum de participants"
)
display = models.BooleanField("Afficher cette activité", default=False) display = models.BooleanField("Afficher cette activité", default=False)
must_book = models.BooleanField("Nécessite inscription", default=False)
host_name = models.CharField("Nom de l'organisateur", max_length=50) host_name = models.CharField("Nom de l'organisateur", max_length=50)
host_email = models.EmailField("Email de l'organisateur") host_email = models.EmailField("Email de l'organisateur")
description = models.TextField("Description", max_length=2000) description = models.TextField("Description", max_length=2000)
@property
def nb_participants(self) -> str:
if self.max_participants == 0:
return "Illimité"
return "{} - {}".format(self.min_paricipants, self.max_participants)
def __str__(self):
return self.title
class InterludesParticipant(models.Model): class InterludesParticipant(models.Model):
"""un participant aux interludes""" """un participant aux interludes"""
...@@ -37,3 +54,4 @@ class ActivityList(models.Model): ...@@ -37,3 +54,4 @@ class ActivityList(models.Model):
class Meta: class Meta:
# le couple participant, priority est unique # le couple participant, priority est unique
unique_together = (("priority", "participant")) unique_together = (("priority", "participant"))
ordering = ("participant", "priority")
...@@ -147,18 +147,16 @@ main a:link { ...@@ -147,18 +147,16 @@ main a:link {
dl { dl {
list-style: none; list-style: none;
display: grid; display: grid;
grid-template-columns: 1fr 5fr; grid-template-columns: 1fr 4fr;
} }
dl dt { dl dt {
grid-column: 1 / span 1; grid-column: 1 / span 1;
justify-self: end; justify-self: end;
text-align: right; text-align: right;
margin: 5px 10px;
font-weight: bold; font-weight: bold;
align-self: center;
} }
dl dd { dl dd {
margin: 5px 5px; margin: 0 10px;
justify-self: start; justify-self: start;
text-align: left; text-align: left;
} }
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
{% block "content" %} {% block "content" %}
<h2>Activités</h2> <h2>Activités</h2>
<p>Durant tout l'événement, des jeux seront en libre-service et des tables disponibles pour jouer.
Certaines activités (JDRs, murders...) ne pourront se faire qu'avec inscription au vue d'un nombre de places limité.
</p>
<p> <p>
TODO : planning et infos si vous voulez proposez une activité TODO : planning et infos si vous voulez proposez une activité
</p> </p>
...@@ -11,7 +14,9 @@ ...@@ -11,7 +14,9 @@
<dl> <dl>
<dt>Durée :</dt><dd>{{ activity.duration }}</dd> <dt>Durée :</dt><dd>{{ activity.duration }}</dd>
<dt>MJ :</dt><dd>{{ activity.host_name }}</dd> <dt>MJ :</dt><dd>{{ activity.host_name }}</dd>
<dt>Description :</dt><dd>{{ activity.description }}</dd> <dt>Nombre de places :</dt><dd>{{ activity.nb_participants }}</dd>
<dt>Sur inscription :</dt><dd>{% if activity.must_book %} Oui {% else %} Non {% endif %}</dd>
<dt>Description :</dt><dd>{{ activity.description|linebreaksbr }}</dd>
</dl> </dl>
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -5,7 +5,7 @@ from django.urls import reverse ...@@ -5,7 +5,7 @@ from django.urls import reverse
from home.models import InterludesActivity from home.models import InterludesActivity
def static_view(request, slug): def static_view(request, slug):
activities = InterludesActivity.objects.filter(display=True) activities = InterludesActivity.objects.filter(display=True).order_by("title")
return render(request, slug+'.html', {'slug': slug, 'activities': activities}) return render(request, slug+'.html', {'slug': slug, 'activities': activities})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment