diff --git a/conftest.py b/conftest.py index 39d2db9..86aedf9 100644 --- a/conftest.py +++ b/conftest.py @@ -76,7 +76,7 @@ def daycare_data(): pytest.DESCRIPTION = "This is the first daycare test" pytest.PRICE_PER_DAY = 10 pytest.CAPACITY = 50 - pytest.AREA = "Merkaz" + pytest.AREA = "C" pytest.CITY = "Tel-Aviv" pytest.ADDRESS = "The best street 5" diff --git a/daycare/migrations/0006_alter_daycare_area.py b/daycare/migrations/0006_alter_daycare_area.py new file mode 100644 index 0000000..73bd90d --- /dev/null +++ b/daycare/migrations/0006_alter_daycare_area.py @@ -0,0 +1,20 @@ +# Generated by Django 4.0.3 on 2022-04-27 13:37 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('daycare', '0005_image_data_migration'), + ] + + operations = [ + migrations.AlterField( + model_name='daycare', + name='area', + field=models.CharField(blank=True, choices=[('N', 'NORTH'), ('S', 'SOUTH'), ('C', 'CENTER')], + max_length=20, validators=[django.core.validators.MaxLengthValidator]), + ), + ] diff --git a/daycare/models.py b/daycare/models.py index 54aa6ea..6911299 100644 --- a/daycare/models.py +++ b/daycare/models.py @@ -10,13 +10,19 @@ from django.core.exceptions import ObjectDoesNotExist +class Area(models.TextChoices): + North = 'N', 'NORTH' + South = 'S', 'SOUTH' + Center = 'C', 'CENTER' + + class DayCare(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, default=None, blank=True, null=False, editable=True) name = models.CharField(max_length=20, blank=True, unique=True, validators=[MaxLengthValidator]) description = models.TextField(blank=True, null=True) price_per_day = models.IntegerField(blank=False, null=False, default=0) capacity = models.IntegerField(null=False, blank=True) - area = models.CharField(max_length=20, blank=True, validators=[MaxLengthValidator]) + area = models.CharField(max_length=20, blank=True, validators=[MaxLengthValidator], choices=Area.choices) city = models.CharField(max_length=20, blank=True, validators=[MaxLengthValidator]) address = models.CharField(max_length=50, blank=True, validators=[MaxLengthValidator])