Skip to content

Commit 81c5f88

Browse files
committed
Shorten email field; add colour
1 parent 429ca3e commit 81c5f88

3 files changed

Lines changed: 31 additions & 19 deletions

File tree

src/community_db/migrations/0002_person_email_address.py

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Generated by Django 4.1 on 2022-09-08 05:03
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("community_db", "0001_initial"),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name="person",
15+
name="email_address",
16+
field=models.EmailField(blank=True, max_length=800),
17+
),
18+
migrations.AddField(
19+
model_name="person",
20+
name="favourite_colour",
21+
field=models.CharField(
22+
choices=[("red", "red"), ("blue", "blue")], default="red", max_length=50
23+
),
24+
),
25+
]

src/community_db/models.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22

33

44
class Person(models.Model):
5+
class Colours(models.TextChoices):
6+
RED = ('red', 'red')
7+
BLUE = ('blue', 'blue')
8+
59
first_name = models.CharField(max_length=100)
610
last_name = models.CharField(max_length=100, blank=True)
711
country = models.CharField(max_length=100, blank=True)
812
mobile_number = models.CharField(max_length=20, blank=True)
9-
email_address = models.EmailField(max_length=900, blank=True)
13+
email_address = models.EmailField(max_length=800, blank=True)
14+
favourite_colour = models.CharField(max_length=50, choices=Colours.choices, default=Colours.RED.value)

0 commit comments

Comments
 (0)