From 7ed6b9712b7f1b97d1242fd5f122fba43e236714 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Fri, 25 Sep 2020 14:20:17 +0200 Subject: [PATCH] Add present field --- media/migrations/0039_mark_media_present.py | 48 +++++++++++++ media/models.py | 42 +++++++++++ media/templates/media/find_medium.html | 77 ++++++++++++++++++--- media/urls.py | 7 ++ media/views.py | 41 ++++++++++- 5 files changed, 203 insertions(+), 12 deletions(-) create mode 100644 media/migrations/0039_mark_media_present.py diff --git a/media/migrations/0039_mark_media_present.py b/media/migrations/0039_mark_media_present.py new file mode 100644 index 0000000..1cf567e --- /dev/null +++ b/media/migrations/0039_mark_media_present.py @@ -0,0 +1,48 @@ +# Generated by Django 2.2.16 on 2020-09-25 12:18 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('media', '0038_auto_20200923_2030'), + ] + + operations = [ + migrations.AddField( + model_name='bd', + name='present', + field=models.BooleanField(default=False, help_text='Tell that the medium is present in the Mediatek.', verbose_name='present'), + ), + migrations.AddField( + model_name='cd', + name='present', + field=models.BooleanField(default=False, help_text='Tell that the medium is present in the Mediatek.', verbose_name='present'), + ), + migrations.AddField( + model_name='futuremedia', + name='present', + field=models.BooleanField(default=False, help_text='Tell that the medium is present in the Mediatek.', verbose_name='present'), + ), + migrations.AddField( + model_name='manga', + name='present', + field=models.BooleanField(default=False, help_text='Tell that the medium is present in the Mediatek.', verbose_name='present'), + ), + migrations.AddField( + model_name='revue', + name='present', + field=models.BooleanField(default=False, help_text='Tell that the medium is present in the Mediatek.', verbose_name='present'), + ), + migrations.AddField( + model_name='roman', + name='present', + field=models.BooleanField(default=False, help_text='Tell that the medium is present in the Mediatek.', verbose_name='present'), + ), + migrations.AddField( + model_name='vinyle', + name='present', + field=models.BooleanField(default=False, help_text='Tell that the medium is present in the Mediatek.', verbose_name='present'), + ), + ] diff --git a/media/models.py b/media/models.py index eb40416..5efc825 100644 --- a/media/models.py +++ b/media/models.py @@ -77,6 +77,12 @@ class BD(models.Model): null=True, ) + present = models.BooleanField( + verbose_name=_("present"), + help_text=_("Tell that the medium is present in the Mediatek."), + default=False, + ) + def __str__(self): if self.subtitle: return "{} : {}".format(self.title, self.subtitle) @@ -136,6 +142,12 @@ class Manga(models.Model): null=True, ) + present = models.BooleanField( + verbose_name=_("present"), + help_text=_("Tell that the medium is present in the Mediatek."), + default=False, + ) + def __str__(self): return self.title @@ -192,6 +204,12 @@ class Roman(models.Model): null=True, ) + present = models.BooleanField( + verbose_name=_("present"), + help_text=_("Tell that the medium is present in the Mediatek."), + default=False, + ) + def __str__(self): return self.title @@ -225,6 +243,12 @@ class Vinyle(models.Model): verbose_name=_('authors'), ) + present = models.BooleanField( + verbose_name=_("present"), + help_text=_("Tell that the medium is present in the Mediatek."), + default=False, + ) + def __str__(self): return self.title @@ -250,6 +274,12 @@ class CD(models.Model): verbose_name=_('authors'), ) + present = models.BooleanField( + verbose_name=_("present"), + help_text=_("Tell that the medium is present in the Mediatek."), + default=False, + ) + def __str__(self): return self.title @@ -295,6 +325,12 @@ class Revue(models.Model): default=False, ) + present = models.BooleanField( + verbose_name=_("present"), + help_text=_("Tell that the medium is present in the Mediatek."), + default=False, + ) + def __str__(self): return self.title + " n°" + str(self.number) @@ -323,6 +359,12 @@ class FutureMedia(models.Model): max_length=8, ) + present = models.BooleanField( + verbose_name=_("present"), + help_text=_("Tell that the medium is present in the Mediatek."), + default=False, + ) + class Meta: verbose_name = _("future medium") verbose_name_plural = _("future media") diff --git a/media/templates/media/find_medium.html b/media/templates/media/find_medium.html index 0e406d4..1a79e2e 100644 --- a/media/templates/media/find_medium.html +++ b/media/templates/media/find_medium.html @@ -1,22 +1,38 @@ {% extends "base.html" %} {% block content %} -
+ - - + + + + +
{% endblock %} {% block extrajavascript %}