UPDATE
This commit is contained in:
@@ -6,9 +6,9 @@ from uuid import UUID
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from farm_data.models import SensorData
|
||||
from farm_data.models import PlantCatalogSnapshot, SensorData
|
||||
from farm_data.services import assign_farm_plants_from_backend_ids
|
||||
from location_data.models import SoilLocation
|
||||
from plant.models import Plant
|
||||
from weather.models import WeatherForecast
|
||||
|
||||
|
||||
@@ -54,9 +54,14 @@ class Command(BaseCommand):
|
||||
"sensor_payload": DEMO_SENSOR_PAYLOAD,
|
||||
},
|
||||
)
|
||||
plants = list(Plant.objects.filter(name__in=DEMO_PLANT_NAMES).order_by("name"))
|
||||
plants = list(
|
||||
PlantCatalogSnapshot.objects.filter(name__in=DEMO_PLANT_NAMES).order_by("name")
|
||||
)
|
||||
if plants:
|
||||
farm_data.plants.set(plants)
|
||||
assign_farm_plants_from_backend_ids(
|
||||
farm_data,
|
||||
[plant.backend_plant_id for plant in plants],
|
||||
)
|
||||
|
||||
status_text = "Created" if created else "Updated"
|
||||
weather_text = weather_forecast.id if weather_forecast else "None"
|
||||
|
||||
Reference in New Issue
Block a user