Skip to content

Commit

Permalink
fix(zone): add way to get data from db, fix migration
Browse files Browse the repository at this point in the history
  • Loading branch information
ollz272 committed May 1, 2023
1 parent 86f4897 commit 3df9dcb
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
1 change: 0 additions & 1 deletion .idea/garden-server.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions apps/zones/migrations/0002_make_plant_zones.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ def set_plant_zone(apps, schema_editor):
# Set the partners' region as the needs region as a default.
for plant in Plant.objects.all():
if plant.indoor:
zone = Zone.objects.get_or_create(user=plant.user, name="indoor")
zone, _ = Zone.objects.get_or_create(user=plant.user, name="indoor")

else:
zone = Zone.objects.get_or_create(user=plant.user, name="outdoor")
zone, _ = Zone.objects.get_or_create(user=plant.user, name="outdoor")

plant.zone = zone
plant.save()
Expand Down
19 changes: 17 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions project/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"crispy_bootstrap5",
"django_extensions",
"colorfield",
"maskpostgresdata",
]

PROJECT_APPS = ["plants", "api", "accounts", "weather", "alerts", "zones"]
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ psycopg = "^3.1.8"
whitenoise = "^6.4.0"
crispy-bootstrap5 = "^0.7"
pytz = "^2023.3"
django-maskpostgresdata = "^0.1.16"


[tool.poetry.group.local.dependencies]
Expand Down

0 comments on commit 3df9dcb

Please sign in to comment.