From a6feb8449fdc9591cd961a8dfd5acf783eb164ab Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Tue, 3 Oct 2023 17:03:42 +0300 Subject: [PATCH 1/3] like/dislike --- db.sqlite3 | Bin 303104 -> 303104 bytes feedback/views.py | 2 +- front/src/components/news-list.vue | 97 +++++++++++++++++++---------- front/src/views/HomePage.vue | 2 +- navigation/views.py | 44 +++++++------ 5 files changed, 90 insertions(+), 55 deletions(-) diff --git a/db.sqlite3 b/db.sqlite3 index 141f6c83da38826cda2ee71c88b0222c96fa8ebc..fa433522867be75f0d55167ca7a36ecfdf49eadd 100644 GIT binary patch delta 574 zcmZXQ!D|yi6vk)XY-h5C_SIsgmV#@MEyZNByR+G3S3IPkf?E;lNvM)j36!?-m8q)DS`*C&o5obOJx^SILXRIEmxX4`m_n z3;vlG{qrH@s?4<)m3Rpm*o)1;`IS?fJCLWDs_sHw@9x0;3(Q4Vi5A?Xu3l)t%CLU> z9#$iQl;y8RjEZ03qJCHCP4 zh&8>i4~|gZI#2Q}rl4x)13i*b@OUh3UlIz>nH$q5^(OMWw0WAzjm8NHh8^xNz78MoKz zGX?8w8z~rATA3JI8JO#tm|9pETN)V{8S5Gv=o(dI?YEyZZNL4T zS(Af@k^cq*{|#hyj7jMCfx|7T`RkYVKi#Q;RkK-CUFtPaHTFbp&;jbnRT21^Y4^csB@L3Skt4W-iJ c)a}3WS-1q)AX+yI9(d2s$guraKMR`x0J98elK=n! diff --git a/feedback/views.py b/feedback/views.py index da8c679f1..8c8aa6b88 100644 --- a/feedback/views.py +++ b/feedback/views.py @@ -28,6 +28,7 @@ class FeedbackAPIView(APIView): instance=nowrating, # Передаём набор записей , "rat":serializer_for_queryset2.data many=True # Указываем, что на вход подаётся именно набор записей ) + return Response({"basecrit":serializer_for_basecrit.data, "nowrating":serializer_for_nowrating.data, "nowcomment": serializer_for_nowcomment.data[0] if len(nowcomment)>0 else None @@ -38,7 +39,6 @@ class FeedbackAPIView(APIView): for x in request.data['nowrating']: RatingStatus.objects.update_or_create(id=x['id'], defaults={'rating':x['rating'], 'crit_id':x['crit'], 'usercom_id':comment.id}) - print(comment, created, 'hhhhhhhhhhhhhhhhhhhhhhhhhhhhhh') return Response({}) diff --git a/front/src/components/news-list.vue b/front/src/components/news-list.vue index 85bfd15b2..a688127ac 100644 --- a/front/src/components/news-list.vue +++ b/front/src/components/news-list.vue @@ -1,11 +1,11 @@