diff --git a/src/community_db/migrations/0002_person_email_address_person_favourite_colour.py b/src/community_db/migrations/0002_person_email_address_person_favourite_colour.py new file mode 100644 index 0000000..1d97978 --- /dev/null +++ b/src/community_db/migrations/0002_person_email_address_person_favourite_colour.py @@ -0,0 +1,25 @@ +# Generated by Django 4.1 on 2022-09-08 05:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("community_db", "0001_initial"), + ] + + operations = [ + migrations.AddField( + model_name="person", + name="email_address", + field=models.EmailField(blank=True, max_length=800), + ), + migrations.AddField( + model_name="person", + name="favourite_colour", + field=models.CharField( + choices=[("red", "red"), ("blue", "blue")], default="red", max_length=50 + ), + ), + ] diff --git a/src/community_db/models.py b/src/community_db/models.py index f0853ab..c50a4d5 100644 --- a/src/community_db/models.py +++ b/src/community_db/models.py @@ -2,7 +2,13 @@ class Person(models.Model): + class Colours(models.TextChoices): + RED = ('red', 'red') + BLUE = ('blue', 'blue') + first_name = models.CharField(max_length=100) last_name = models.CharField(max_length=100, blank=True) country = models.CharField(max_length=100, blank=True) mobile_number = models.CharField(max_length=20, blank=True) + email_address = models.EmailField(max_length=800, blank=True) + favourite_colour = models.CharField(max_length=50, choices=Colours.choices, default=Colours.RED.value) \ No newline at end of file