Исправлена сборка объекта на бэке

This commit is contained in:
Alex committed 2024-01-23 17:51:41 +03:00
1 parent 241966bb89
commit 8885fa0949
2 files changed
+16 -14

No files matched your search

+15 -13
View File
@@ -9,19 +9,21 @@
<!-- {{ safetyData }} --> <!-- {{ safetyData }} -->
<v-row class="bg-red"> <v-row class="bg-red">
<v-col> <v-col>
<v-card class="bg-orange" v-for="item in safetyData" :key="item.id"> <v-card v-for="item in safetyData" :key="item.id">
<v-card-title>{{ item.name }}</v-card-title> <v-card-title>{{ item.name }}</v-card-title>
<v-card-actions v-for="category in item.categories" :key="category.id"> <v-card-actions v-for="category in item.categories" :key="item.id + category.id" >
<v-btn>{{ category.name }}</v-btn> <v-btn>{{ category.name }}</v-btn>
<v-btn :icon="showMore[category.id] ? 'mdi-chevron-up' : 'mdi-chevron-down'" @click="showMore[category.id] = !showMore[category.id]"></v-btn> <v-btn
:icon="showMore[item.id + category.id] ? 'mdi-chevron-up' : 'mdi-chevron-down'"
@click="showMore[item.id + category.id] = !showMore[item.id + category.id]">
</v-btn>
<v-expand-transition> <v-expand-transition>
<div v-show="showMore[category.id]"> <div v-show="showMore[item.id + category.id]">
<!-- <v-divider></v-divider> --> <v-card-actions v-for="file in category.files" :key="file.id">
<v-card-actions v-for="file in category.files" :key="file.id"> <v-card-text>{{ file.name }}</v-card-text>
<v-card-text>{{ file.name }}</v-card-text> <v-btn icon="mdi-eye" color="grey"></v-btn>
<v-btn icon="mdi-eye" color="grey"></v-btn> <v-btn icon='mdi-cloud-download' color="grey"></v-btn>
<v-btn icon='mdi-cloud-download' color="grey"></v-btn> </v-card-actions>
</v-card-actions>
</div> </div>
</v-expand-transition> </v-expand-transition>
</v-card-actions> </v-card-actions>
@@ -45,8 +47,7 @@ onBeforeMount(() => {
axiosApiInstance.get(`api/safety/files/`).then(result => { axiosApiInstance.get(`api/safety/files/`).then(result => {
safetyData.value = result.data safetyData.value = result.data
}) })
console.log(safetyData);
console.log(safetyData.value);
}); });
@@ -57,4 +58,5 @@ showMore.value = safetyData.value.reduce((acc, value) => {
</script> </script>
<style></style> <style>
</style>
+1 -1
View File
@@ -10,7 +10,7 @@ from .models import *
class SafetyFileAPIView(APIView): class SafetyFileAPIView(APIView):
def get(self, request): def get(self, request):
all_file = SafetyFile.objects.all() all_file = SafetyFile.objects.order_by('chapter_id', 'category_id').all()
serializer_for_file = SafetyFileSerializer(instance=all_file, many=True) serializer_for_file = SafetyFileSerializer(instance=all_file, many=True)
data = [] data = []