Compare commits
No commits in common. "afa3b8b9ad9a70960c2191aaee2a479d6885f1ff" and "db910f08040c937f9fe65d6cc3f3877e5173c09f" have entirely different histories.
afa3b8b9ad
...
db910f0804
|
|
@ -1077,15 +1077,6 @@ class BatchStViewSet(CustomListModelMixin, ComplexQueryMixin, CustomGenericViewS
|
||||||
ordering = ["batch"]
|
ordering = ["batch"]
|
||||||
filterset_class = BatchStFilter
|
filterset_class = BatchStFilter
|
||||||
|
|
||||||
def add_info_for_list(self, data):
|
|
||||||
if self.request.query_params.get("with_source_near", None) == "yes":
|
|
||||||
batchstIds = [ins["id"] for ins in data]
|
|
||||||
batchlog_qs = BatchLog.objects.filter(target__id__in=batchstIds).values("id", "source", "target")
|
|
||||||
source_data = BatchStSerializer(instance=BatchSt.objects.filter(id__in=[ins["source"] for ins in batchlog_qs]), many=True).data
|
|
||||||
source_data_dict = {ins["id"]: ins for ins in source_data}
|
|
||||||
for item in data:
|
|
||||||
item["source_near"] = [source_data_dict[ins["source"]] for ins in batchlog_qs if ins["target"] == item["id"]]
|
|
||||||
return data
|
|
||||||
|
|
||||||
class MlogbwViewSet(CustomModelViewSet):
|
class MlogbwViewSet(CustomModelViewSet):
|
||||||
perms_map = {"get": "*", "post": "mlog.update", "put": "mlog.update", "delete": "mlog.update", "patch": "mlog.update"}
|
perms_map = {"get": "*", "post": "mlog.update", "put": "mlog.update", "delete": "mlog.update", "patch": "mlog.update"}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue