remove wagtail and admin website, remove edit option, from hitung ayam, add create flock to settings
This commit is contained in:
1 parent
74dd3faf60
commit
30a736641f
39 files changed
+634
-819
No files matched your search
@@ -53,7 +53,7 @@ class CycleScopedViewSet(VisibilityFilteredMixin, viewsets.ModelViewSet):
|
||||
if params.get("cycle_id"):
|
||||
qs = qs.filter(cycle_id=params["cycle_id"])
|
||||
if params.get("flock_id"):
|
||||
qs = qs.filter(cycle__flocks__flock_id=params["flock_id"]).distinct()
|
||||
qs = qs.filter(cycle__kandang__flocks=params["flock_id"]).distinct()
|
||||
if params.get("date"):
|
||||
qs = qs.filter(date=params["date"])
|
||||
return self.filter_visible_through(qs)
|
||||
@@ -143,14 +143,23 @@ class FeedSacksViewSet(CycleScopedViewSet):
|
||||
|
||||
class IotPanelViewSet(viewsets.ModelViewSet):
|
||||
"""IoT panel is real-time — not subject to the 17:00 dashboard publish cutoff."""
|
||||
queryset = IotPanel.objects.select_related("flock", "flock__cycle").all()
|
||||
queryset = IotPanel.objects.select_related("flock", "flock__kandang").all()
|
||||
serializer_class = IotPanelSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
qs = super().get_queryset()
|
||||
params = self.request.query_params
|
||||
if params.get("cycle_id"):
|
||||
qs = qs.filter(flock__cycle_id=params["cycle_id"])
|
||||
cycle_id = params.get("cycle_id")
|
||||
if cycle_id:
|
||||
try:
|
||||
cycle = Cycle.objects.get(pk=cycle_id)
|
||||
except Cycle.DoesNotExist:
|
||||
return qs.none()
|
||||
qs = qs.filter(
|
||||
flock__kandang_id=cycle.kandang_id,
|
||||
date__gte=cycle.start_date,
|
||||
date__lte=cycle.end_date,
|
||||
)
|
||||
if params.get("flock_id"):
|
||||
qs = qs.filter(flock_id=params["flock_id"])
|
||||
if params.get("date"):
|
||||
|
||||
Reference in new issue
Block a user