adjust citysite table name to activesites

This commit is contained in:
Alberto-Audrix committed 2026-09-11 15:51:29 +07:00
1 parent fb0f996776
commit 64b37b6b6d
27 files changed
+382 -221

No files matched your search

+11 -9
View File
@@ -11,9 +11,9 @@ class Site(models.Model):
site_id = models.BigAutoField(primary_key=True)
site_name = models.CharField(max_length=30)
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name="sites")
# Linked when GM/GM Admin adds the city dashboard to their Pengaturan view list.
city_site = models.OneToOneField(
"sync.CitySite",
# Linked when GM/GM Admin adds the site dashboard to their Pengaturan view list.
active_site = models.OneToOneField(
"sync.ActiveSite",
null=True,
blank=True,
on_delete=models.SET_NULL,
@@ -87,8 +87,8 @@ class Cycle(models.Model):
max_length=30, choices=STATUS_CHOICES, default=STATUS_ACTIVE, db_index=True
)
kandang = models.ForeignKey(Kandang, on_delete=models.CASCADE, related_name="cycles")
city_site = models.ForeignKey(
"sync.CitySite",
active_site = models.ForeignKey(
"sync.ActiveSite",
null=True,
blank=True,
on_delete=models.SET_NULL,
@@ -97,7 +97,7 @@ class Cycle(models.Model):
source_cycle_id = models.BigIntegerField(
null=True,
blank=True,
help_text="cycle_id on the city dashboard-cpsp deployment",
help_text="cycle_id on the farm-location dashboard-cpsp deployment",
)
proposed_end_date = models.DateField(null=True, blank=True)
close_requested_at = models.DateTimeField(null=True, blank=True)
@@ -129,9 +129,11 @@ class Cycle(models.Model):
name="chk_cycles_date_range",
),
models.UniqueConstraint(
fields=["city_site", "source_cycle_id"],
condition=models.Q(city_site__isnull=False, source_cycle_id__isnull=False),
name="uniq_cycle_city_source",
fields=["active_site", "source_cycle_id"],
condition=models.Q(
active_site__isnull=False, source_cycle_id__isnull=False
),
name="uniq_cycle_active_source",
),
]