Skip to content

Commit

Permalink
Merge pull request #3 from Fer-Bar/hotfix/testviews
Browse files Browse the repository at this point in the history
Hotfix/testviews
  • Loading branch information
Fer-Bar authored Mar 19, 2024
2 parents 7d3ed6f + 884d4b2 commit f44f08d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ repos:
entry: isort
additional_dependencies: [isort]
types: [python]
exclude: 'migrations/.*|setup.py'

- id: flake8
name: flake8
Expand All @@ -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
Expand Down
23 changes: 23 additions & 0 deletions pet/migrations/0007_pet_gender_pet_is_neutered.py
Original file line number Diff line number Diff line change
@@ -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'),
),
]
11 changes: 11 additions & 0 deletions pet/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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):
Expand Down

0 comments on commit f44f08d

Please sign in to comment.