diff --git a/beesgospel/forms.py b/beesgospel/forms.py index 2189a0d..c6be86c 100644 --- a/beesgospel/forms.py +++ b/beesgospel/forms.py @@ -55,27 +55,6 @@ class MembreEditForm(BootstrapMixin, forms.ModelForm): return super().save(**kwargs) -class ChantDocForm(BootstrapMixin, forms.ModelForm): - class Meta: - model = ChantDoc - fields = ["fichier", "lien", "titre"] - - def __init__(self, **kwargs): - super().__init__(**kwargs) - if self.instance.pk and not self.instance.lien: - del self.fields["lien"] - if self.instance.pk:# and not self.instance.fichier: - del self.fields["fichier"] - - def clean(self): - data = super().clean() - if not data.get("fichier") and not data.get("lien"): - raise forms.ValidationError("Vous devez indiquer un fichier ou un lien") - elif data.get("fichier") and data.get("lien"): - raise forms.ValidationError("Vous ne pouvez pas indiquer à la fois un fichier et un lien") - return data - - class ChantEditForm(BootstrapMixin, forms.ModelForm): class Meta: model = Chant @@ -85,7 +64,7 @@ class ChantEditForm(BootstrapMixin, forms.ModelForm): super().__init__(**kwargs) self.formset = None if self.instance.pk: - DocFormSet = forms.inlineformset_factory(Chant, ChantDoc, form=ChantDocForm, extra=1) + DocFormSet = forms.inlineformset_factory(Chant, ChantDoc, fields=["fichier", "titre"], extra=1) self.formset = DocFormSet(data=kwargs.get("data"), files=kwargs.get("files"), instance=self.instance) def is_valid(self): diff --git a/beesgospel/migrations/0008_chantdoc_lien.py b/beesgospel/migrations/0008_chantdoc_lien.py deleted file mode 100644 index c4aacc6..0000000 --- a/beesgospel/migrations/0008_chantdoc_lien.py +++ /dev/null @@ -1,16 +0,0 @@ -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('beesgospel', '0007_chantdoc'), - ] - - operations = [ - migrations.AddField( - model_name='chantdoc', - name='lien', - field=models.URLField(blank=True, verbose_name='Lien'), - ), - ] diff --git a/beesgospel/models.py b/beesgospel/models.py index 29039fc..e9cafe2 100644 --- a/beesgospel/models.py +++ b/beesgospel/models.py @@ -123,7 +123,6 @@ class Chant(models.Model): class ChantDoc(models.Model): chant = models.ForeignKey(Chant, on_delete=models.CASCADE) fichier = models.FileField("Fichier", upload_to="chants", blank=True) - lien = models.URLField("Lien", blank=True) titre = models.CharField("Titre", max_length=200) def __str__(self): diff --git a/beesgospel/static/css/main.css b/beesgospel/static/css/main.css index d910ef9..77bcfe4 100644 --- a/beesgospel/static/css/main.css +++ b/beesgospel/static/css/main.css @@ -58,7 +58,6 @@ nav { .red-bottom { border-bottom: 1px solid red; } .overleft { margin-left: -4rem; } .overright { margin-right: -4rem; } -.icon { max-width: 1.5rem; } .harlow { font-family: "Harlow Solid"; } .homeurl { color: white; text-decoration: none; } .homeurl:hover { color: lightgrey; } diff --git a/beesgospel/static/img/web-icon.svg b/beesgospel/static/img/web-icon.svg deleted file mode 100644 index b8a6caf..0000000 --- a/beesgospel/static/img/web-icon.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index cb88f14..d17b716 100644 --- a/templates/base.html +++ b/templates/base.html @@ -22,7 +22,7 @@ -