UPDATE
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import uuid
|
||||
|
||||
from django.db import models
|
||||
|
||||
from farm_hub.models import FarmHub
|
||||
|
||||
|
||||
class IrrigationRecommendationRequest(models.Model):
|
||||
uuid = models.UUIDField(default=uuid.uuid4, unique=True, editable=False, db_index=True)
|
||||
farm = models.ForeignKey(
|
||||
FarmHub,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="irrigation_recommendations",
|
||||
)
|
||||
crop_id = models.CharField(max_length=255, blank=True, default="")
|
||||
task_id = models.CharField(max_length=255, blank=True, default="", db_index=True)
|
||||
status = models.CharField(max_length=64, blank=True, default="")
|
||||
request_payload = models.JSONField(default=dict, blank=True)
|
||||
response_payload = models.JSONField(default=dict, blank=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
class Meta:
|
||||
db_table = "irrigation_recommendation_requests"
|
||||
ordering = ["-created_at", "-id"]
|
||||
|
||||
def __str__(self):
|
||||
return self.task_id or str(self.uuid)
|
||||
Reference in New Issue
Block a user