Set list de repet: front end random fanfaron
This commit is contained in:
parent
149cc3b9f0
commit
10159393f1
4 changed files with 24 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from .models import Category, PartitionSet
|
from .models import Category, PartitionSet, SetList
|
||||||
|
|
||||||
admin.site.register(Category)
|
admin.site.register(Category)
|
||||||
admin.site.register(PartitionSet)
|
admin.site.register(PartitionSet)
|
||||||
|
admin.site.register(SetList)
|
||||||
|
|
|
@ -70,3 +70,11 @@ class PartitionSet(models.Model):
|
||||||
verbose_name = _("Morceau")
|
verbose_name = _("Morceau")
|
||||||
verbose_name_plural = _("Morceaux")
|
verbose_name_plural = _("Morceaux")
|
||||||
ordering = (Lower("nom"),)
|
ordering = (Lower("nom"),)
|
||||||
|
|
||||||
|
class SetList(models.Model):
|
||||||
|
"""
|
||||||
|
Modèle qui stocke les metadonnées d'une setlist de répèt (date, si c'est la repet _active_)
|
||||||
|
"""
|
||||||
|
date = models.DateField(_("Date de la répèt"))
|
||||||
|
is_current = models.BooleanField(_("Afficher la répèt"), default=False)
|
||||||
|
morceaux = models.ManyToManyField("PartitionSet", verbose_name=_("Morceaux de la répèt"))
|
||||||
|
|
|
@ -7,6 +7,18 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<section class="wrapper style1">
|
<section class="wrapper style1">
|
||||||
|
{% if user.is_authenticated and setlists %}
|
||||||
|
<div class="inner">
|
||||||
|
{% for set_list in setlists %}
|
||||||
|
<h4>Programme de repet de la semaine du {{ set_list.date }}</h4>
|
||||||
|
<ul class="pl-5">
|
||||||
|
{% for morceau in set_list.morceaux.all %}
|
||||||
|
<li>{{ morceau.nom }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
|
|
||||||
<span class="image fit">
|
<span class="image fit">
|
||||||
|
|
|
@ -15,7 +15,7 @@ from django.views.generic import TemplateView
|
||||||
from gestion.mixins import ChefRequiredMixin
|
from gestion.mixins import ChefRequiredMixin
|
||||||
from gestion.models import Photo
|
from gestion.models import Photo
|
||||||
from partitions.forms import UploadFileForm, UploadMorceauForm
|
from partitions.forms import UploadFileForm, UploadMorceauForm
|
||||||
from partitions.models import Category, Partition, PartitionSet
|
from partitions.models import Category, Partition, PartitionSet, SetList
|
||||||
|
|
||||||
from .forms import ChefEditMorceauForm
|
from .forms import ChefEditMorceauForm
|
||||||
|
|
||||||
|
@ -74,6 +74,7 @@ class Repertoire(TemplateView):
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
|
context["setlists"] = SetList.objects.filter(is_current=True).order_by('date').prefetch_related('morceaux')
|
||||||
context["categories"] = Category.objects.prefetch_related(
|
context["categories"] = Category.objects.prefetch_related(
|
||||||
"partitionset_set"
|
"partitionset_set"
|
||||||
).order_by("order")
|
).order_by("order")
|
||||||
|
|
Loading…
Reference in a new issue