Skip to content

Commit

Permalink
Added gender and is_neutered fields to pet model
Browse files Browse the repository at this point in the history
  • Loading branch information
Fer-Bar committed Mar 19, 2024
1 parent dfd62ff commit 04ddb36
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
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 04ddb36

Please sign in to comment.