Suppression de Chant.numero
This commit is contained in:
parent
87ca842293
commit
daca903aba
7 changed files with 25 additions and 14 deletions
|
|
@ -27,10 +27,10 @@ class MembreAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
@admin.register(Chant)
|
@admin.register(Chant)
|
||||||
class ChantAdmin(admin.ModelAdmin):
|
class ChantAdmin(admin.ModelAdmin):
|
||||||
list_display = ["numero", "titre", "particularite", "statut"]
|
list_display = ["titre", "particularite", "statut"]
|
||||||
list_filter = ["statut"]
|
list_filter = ["statut"]
|
||||||
search_fields = ["titre"]
|
search_fields = ["titre"]
|
||||||
ordering = ["numero"]
|
ordering = ["titre"]
|
||||||
|
|
||||||
|
|
||||||
@admin.register(User)
|
@admin.register(User)
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ class ChantDocForm(BootstrapMixin, forms.ModelForm):
|
||||||
class ChantEditForm(BootstrapMixin, forms.ModelForm):
|
class ChantEditForm(BootstrapMixin, forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Chant
|
model = Chant
|
||||||
fields = ["numero", "titre", "particularite"]
|
fields = ["titre", "particularite"]
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
|
||||||
19
beesgospel/migrations/0009_remove_numero.py
Normal file
19
beesgospel/migrations/0009_remove_numero.py
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('beesgospel', '0008_chantdoc_lien'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveConstraint(
|
||||||
|
model_name='chant',
|
||||||
|
name='numero_unique',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='chant',
|
||||||
|
name='numero',
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -106,18 +106,12 @@ class Chant(models.Model):
|
||||||
PREP = "prep", "En préparation"
|
PREP = "prep", "En préparation"
|
||||||
INACTIF = "inactif", "Inactif"
|
INACTIF = "inactif", "Inactif"
|
||||||
|
|
||||||
numero = models.PositiveSmallIntegerField("Numéro")
|
|
||||||
titre = models.CharField("Titre", max_length=100)
|
titre = models.CharField("Titre", max_length=100)
|
||||||
particularite = models.CharField("Particularité", max_length=100, blank=True)
|
particularite = models.CharField("Particularité", max_length=100, blank=True)
|
||||||
statut = models.CharField("Statut", max_length=10, choices=StatutChoices, default="actif")
|
statut = models.CharField("Statut", max_length=10, choices=StatutChoices, default="actif")
|
||||||
|
|
||||||
class Meta:
|
|
||||||
constraints = [
|
|
||||||
models.UniqueConstraint("numero", name="numero_unique"),
|
|
||||||
]
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.numero}. {self.titre}"
|
return self.titre
|
||||||
|
|
||||||
|
|
||||||
class ChantDoc(models.Model):
|
class ChantDoc(models.Model):
|
||||||
|
|
|
||||||
|
|
@ -126,5 +126,4 @@ tr.editable:hover .edit-button, tr.editable:hover .delete-button { display: inli
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
table.table-chants th.numero { width: 3em; }
|
|
||||||
table.table-chants th.boutons { width: 3em; }
|
table.table-chants th.boutons { width: 3em; }
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ class ListeChantsView(LoginRequiredMixin, ListView):
|
||||||
template_name = "membres/liste_chants.html"
|
template_name = "membres/liste_chants.html"
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return super().get_queryset().prefetch_related("chantdoc_set").order_by("numero")
|
return super().get_queryset().prefetch_related("chantdoc_set").order_by("titre")
|
||||||
|
|
||||||
|
|
||||||
class ChantAddView(PermissionRequiredMixin, CreateView):
|
class ChantAddView(PermissionRequiredMixin, CreateView):
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,10 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Liste des chants</h2>
|
<h2>Liste des chants</h2>
|
||||||
<table class="table table-striped table-bordered table-responsive table-chants">
|
<table class="table table-striped table-bordered table-responsive table-chants">
|
||||||
<tr><th scope="col" class="numero">N°</th><th scope="col">Titre</th><th></th><th></th>
|
<tr><th scope="col">Titre</th><th></th><th></th>
|
||||||
{% if perms.beesgospel.change_chant %}<th scope="col" class="boutons"></th>{% endif %}</tr>
|
{% if perms.beesgospel.change_chant %}<th scope="col" class="boutons"></th>{% endif %}</tr>
|
||||||
{% for chant in object_list %}
|
{% for chant in object_list %}
|
||||||
<tr class="editable">
|
<tr class="editable">
|
||||||
<td>{{ chant.numero }}</td>
|
|
||||||
<td>{{ chant.titre }}</td>
|
<td>{{ chant.titre }}</td>
|
||||||
<td>{% for doc in chant.chantdoc_set.all %}
|
<td>{% for doc in chant.chantdoc_set.all %}
|
||||||
{% if doc.fichier %}
|
{% if doc.fichier %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue