diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 694928e..13a82b4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,6 +9,7 @@ repos: entry: isort additional_dependencies: [isort] types: [python] + exclude: 'migrations/.*|setup.py' - id: flake8 name: flake8 @@ -18,7 +19,7 @@ repos: entry: flake8 additional_dependencies: [flake8, Flake8-pyproject] types: [python] - exclude: setup.py + exclude: 'migrations/.*|setup.py' args: [--max-line-length=100] - id: pytest diff --git a/pet/migrations/0007_pet_gender_pet_is_neutered.py b/pet/migrations/0007_pet_gender_pet_is_neutered.py new file mode 100644 index 0000000..f8d4838 --- /dev/null +++ b/pet/migrations/0007_pet_gender_pet_is_neutered.py @@ -0,0 +1,23 @@ +# Generated by Django 5.0.2 on 2024-03-19 21:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('pet', '0006_alter_pet_owner'), + ] + + operations = [ + migrations.AddField( + model_name='pet', + name='gender', + field=models.CharField(blank=True, choices=[('F', 'Female'), ('M', 'Male')], max_length=1, verbose_name='gender'), + ), + migrations.AddField( + model_name='pet', + name='is_neutered', + field=models.BooleanField(default=False, verbose_name='is_neutered'), + ), + ] diff --git a/pet/models.py b/pet/models.py index 8d69b8e..24b2f49 100644 --- a/pet/models.py +++ b/pet/models.py @@ -5,7 +5,17 @@ class Pet(models.Model): + GENDER_CHOICES = ( + ("F", _("Female")), + ("M", _("Male")), + ) name = models.CharField(max_length=40, blank=False, null=False, verbose_name=_("name")) + gender = models.CharField( + max_length=1, + choices=GENDER_CHOICES, + blank=True, + verbose_name=_("gender"), + ) owner = models.ForeignKey( "people.Person", on_delete=models.SET_NULL, @@ -23,6 +33,7 @@ class Pet(models.Model): blank=True, verbose_name=_("breed") ) + is_neutered = models.BooleanField(default=False, verbose_name=_("is_neutered")) @property def age(self):