Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add search day-care functionality to dog-owner homepage. #89

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Why not using the full name? 🙂

pytest.CITY = "Tel-Aviv"
pytest.ADDRESS = "The best street 5"

Expand Down
20 changes: 20 additions & 0 deletions daycare/migrations/0006_alter_daycare_area.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 4.0.3 on 2022-04-27 13:37
Yuval-Vino marked this conversation as resolved.
Show resolved Hide resolved

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]),
),
]
8 changes: 7 additions & 1 deletion daycare/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we include that in some of the daycare fixtures?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Area field in create_day_care_user from the confest been updated.

city = models.CharField(max_length=20, blank=True, validators=[MaxLengthValidator])
address = models.CharField(max_length=50, blank=True, validators=[MaxLengthValidator])

Expand Down