diff --git a/requirements.txt b/requirements.txt index 6185bf1..7dc4ffd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,4 @@ Pillow psycopg2-binary httpx django-tastypie -# django-admin-list-filter-dropdown +django-admin-list-filter-dropdown diff --git a/source/main/admin.py b/source/main/admin.py index ff57196..18cebfe 100644 --- a/source/main/admin.py +++ b/source/main/admin.py @@ -29,8 +29,9 @@ class AdminPerson(admin.ModelAdmin): 'country', 'is_actor', 'is_director') + 'is_woman') search_fields = ('name',) - list_filter = ('is_actor', 'is_director', 'country') + list_filter = ('is_woman', 'is_actor', 'is_director', 'country') @admin.register(models.Movie) diff --git a/source/main/migrations/0004_auto_20210807_2207.py b/source/main/migrations/0004_auto_20210807_2207.py new file mode 100644 index 0000000..a41e3f4 --- /dev/null +++ b/source/main/migrations/0004_auto_20210807_2207.py @@ -0,0 +1,28 @@ +# Generated by Django 3.2.6 on 2021-08-07 22:07 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0003_movie_is_digital'), + ] + + operations = [ + migrations.AddField( + model_name='person', + name='is_woman', + field=models.BooleanField(default=False, verbose_name='Es mujer'), + ), + migrations.AlterField( + model_name='country', + name='name', + field=models.CharField(max_length=250, verbose_name='País'), + ), + migrations.AlterField( + model_name='movie', + name='actors', + field=models.ManyToManyField(blank=True, related_name='actors', to='main.Person'), + ), + ] diff --git a/source/main/models.py b/source/main/models.py index a954867..924541e 100644 --- a/source/main/models.py +++ b/source/main/models.py @@ -4,6 +4,7 @@ from django.db import models class Gender(models.Model): + id = models.AutoField(primary_key=True) name = models.CharField(max_length=250) class Meta: @@ -17,6 +18,7 @@ class Gender(models.Model): class Country(models.Model): + id = models.AutoField(primary_key=True) name = models.CharField(max_length=250, verbose_name='País') class Meta: @@ -41,6 +43,7 @@ class PersonQuerySet(models.QuerySet): class Person(models.Model): + id = models.AutoField(primary_key=True) name = models.CharField('Nombre', max_length=500) country = models.ForeignKey(Country, @@ -51,6 +54,8 @@ class Person(models.Model): default=False) is_director = models.BooleanField('Es Director', default=False) + is_woman = models.BooleanField('Es mujer', + default=False) photo = models.ImageField('Fotografía', upload_to='%Y/%m/%d/', null=True, blank=True) objects = PersonQuerySet.as_manager() @@ -133,6 +138,7 @@ def upload_cartel(instance, filename): class Movie(models.Model): + id = models.AutoField(primary_key=True) name = models.CharField('Nombre', max_length=1000) original_name = models.CharField('Nombre original',