2026-04-28 04:11:09 +03:30
|
|
|
from rest_framework import serializers
|
|
|
|
|
|
|
|
|
|
from farm_hub.models import Product
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PlantSerializer(serializers.ModelSerializer):
|
|
|
|
|
id = serializers.IntegerField(read_only=True)
|
|
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
model = Product
|
|
|
|
|
fields = [
|
|
|
|
|
"id",
|
|
|
|
|
"name",
|
2026-05-05 00:56:05 +03:30
|
|
|
"description",
|
|
|
|
|
"metadata",
|
2026-04-28 04:11:09 +03:30
|
|
|
"light",
|
|
|
|
|
"watering",
|
|
|
|
|
"soil",
|
|
|
|
|
"temperature",
|
|
|
|
|
"growth_stage",
|
|
|
|
|
"growth_stages",
|
|
|
|
|
"icon",
|
|
|
|
|
"planting_season",
|
|
|
|
|
"harvest_time",
|
|
|
|
|
"spacing",
|
|
|
|
|
"fertilizer",
|
2026-05-05 00:56:05 +03:30
|
|
|
"health_profile",
|
|
|
|
|
"irrigation_profile",
|
|
|
|
|
"growth_profile",
|
2026-04-28 04:11:09 +03:30
|
|
|
"created_at",
|
|
|
|
|
"updated_at",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PlantNameSerializer(serializers.ModelSerializer):
|
|
|
|
|
class Meta:
|
|
|
|
|
model = Product
|
|
|
|
|
fields = ["name", "icon", "growth_stages"]
|