diff --git a/beesgospel/admin.py b/beesgospel/admin.py index b21d25d..a8e71a4 100644 --- a/beesgospel/admin.py +++ b/beesgospel/admin.py @@ -27,10 +27,10 @@ class MembreAdmin(admin.ModelAdmin): @admin.register(Chant) class ChantAdmin(admin.ModelAdmin): - list_display = ["numero", "titre", "particularite", "statut"] + list_display = ["titre", "particularite", "statut"] list_filter = ["statut"] search_fields = ["titre"] - ordering = ["numero"] + ordering = ["titre"] @admin.register(User) diff --git a/beesgospel/forms.py b/beesgospel/forms.py index 2189a0d..2a5161f 100644 --- a/beesgospel/forms.py +++ b/beesgospel/forms.py @@ -79,7 +79,7 @@ class ChantDocForm(BootstrapMixin, forms.ModelForm): class ChantEditForm(BootstrapMixin, forms.ModelForm): class Meta: model = Chant - fields = ["numero", "titre", "particularite"] + fields = ["titre", "particularite"] def __init__(self, **kwargs): super().__init__(**kwargs) diff --git a/beesgospel/migrations/0009_remove_numero.py b/beesgospel/migrations/0009_remove_numero.py new file mode 100644 index 0000000..1779c85 --- /dev/null +++ b/beesgospel/migrations/0009_remove_numero.py @@ -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', + ), + ] diff --git a/beesgospel/models.py b/beesgospel/models.py index 29039fc..e4fdcfb 100644 --- a/beesgospel/models.py +++ b/beesgospel/models.py @@ -106,18 +106,12 @@ class Chant(models.Model): PREP = "prep", "En préparation" INACTIF = "inactif", "Inactif" - numero = models.PositiveSmallIntegerField("Numéro") titre = models.CharField("Titre", max_length=100) particularite = models.CharField("Particularité", max_length=100, blank=True) statut = models.CharField("Statut", max_length=10, choices=StatutChoices, default="actif") - class Meta: - constraints = [ - models.UniqueConstraint("numero", name="numero_unique"), - ] - def __str__(self): - return f"{self.numero}. {self.titre}" + return self.titre class ChantDoc(models.Model): diff --git a/beesgospel/static/css/main.css b/beesgospel/static/css/main.css index d910ef9..f9c0a9c 100644 --- a/beesgospel/static/css/main.css +++ b/beesgospel/static/css/main.css @@ -126,5 +126,4 @@ tr.editable:hover .edit-button, tr.editable:hover .delete-button { display: inli text-decoration: none; height: 100%; } -table.table-chants th.numero { width: 3em; } table.table-chants th.boutons { width: 3em; } diff --git a/beesgospel/views.py b/beesgospel/views.py index 3186763..4732edc 100644 --- a/beesgospel/views.py +++ b/beesgospel/views.py @@ -134,7 +134,7 @@ class ListeChantsView(LoginRequiredMixin, ListView): template_name = "membres/liste_chants.html" 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): diff --git a/templates/membres/liste_chants.html b/templates/membres/liste_chants.html index e4f31cd..83de253 100644 --- a/templates/membres/liste_chants.html +++ b/templates/membres/liste_chants.html @@ -4,11 +4,10 @@ {% block content %}
| N° | Titre | + | |
|---|---|---|---|
| Titre | {% if perms.beesgospel.change_chant %} | {% endif %} | |
| {{ chant.numero }} | {{ chant.titre }} | {% for doc in chant.chantdoc_set.all %} {% if doc.fichier %} |