From 643d14c35d3aadff29659781c50c61329921568b Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Fri, 8 Sep 2023 12:26:38 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B2=20=D0=91=D0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db.sqlite3 | Bin 225280 -> 225280 bytes feedback/urls.py | 1 + feedback/views.py | 11 ++++++++--- front/src/components/cardLike.vue | 12 ++++++++++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/db.sqlite3 b/db.sqlite3 index 391ebd89167d9c855e8e8fc0570daf873746ae62..a3883d21124057f72e5d78d4d19554a7863bf172 100644 GIT binary patch delta 607 zcmZp8z}xVEcY-wIl!-FVj8iryMCh^ci;FRva!hy3VH9b;q__Q&9;4Ai9v1E#2EN<8 z+ju5&=WI4qh~d^~Qet8CZ4P!!%gQq^$}}}9OV6w{vB)h1sE-AH~ zeovNZvsY@kL9SI`N@}24qDf_NpoOP-KxA%kX`W9?pmBk}ce+cJsku{WkVja#PqK%l zi;0nek+H6UrLK{Yf`Pe}v5A$5fu5n5$Th0QKo<2vG zNoxBceT@L%Fz z#9zek$S=TmpKl#s6Q47m2=9fha?G1}Sr`}?il<-UW!A0-vRoW_;f^r?TE)Pi%g@T- zsE#6NVP#@rWn`ddVQ2{qpp@dY;*_*BAO%GHwwyra?g-`P3Wmm3riNA~hI;0f7AA&9 zi8ui>P-c50A9J&!6c_(d2L7-7@A+TyKjy#7f1Up#|7rfC{J;5sZ3I+)O$`+^)#e`%4K)P~mTfKR&=Cbe zIEN*9*di3s;BrdPkdoEZ)YM#uQ!St6^ZCLz-=p~+Jqn@CVt4^1~7ee)5qD6kh=6N^ zx-7su+(X&b$KZ*OEV9lfanQb7!Et{eAt{=vDJD1MBu}MPqn5*H*V^geVPcrNRq0~c zp6lSpsh~(50orf@TaX1mdu5kwpRKYe{ke&dYwC$JuV6h<5?hz3SIAPNa#f4-betO! zPnrqC)HK;hYpFDcS)W_P{ub^HT{V@2tfY*Tp*!cTg41Xnw(`!cQ&B-4atAZkA|oO8 w-`RVN6rw>9>H>Vj7kt78bm19V(1ZtQK;4dTatb3}f)KDiX`ep3nISs=1;%Y}NB{r; diff --git a/feedback/urls.py b/feedback/urls.py index ca0eb55fd..33f82ede7 100644 --- a/feedback/urls.py +++ b/feedback/urls.py @@ -4,6 +4,7 @@ from .views import * urlpatterns = [ path('baseCriteria/', BaseCriteriaAPI.as_view(), name='baseCriteria'), path('userComment/', UserCommentAPI.as_view(), name='userComment'), + path('userCommentUp//', UserCommentUpdateAPI.as_view(), name='userCommentUp'), path('formfeed/', FormFeedAPI.as_view(), name='form'), path('formupdate/', FormUpdateAPI.as_view(), name='formupdate'), ] \ No newline at end of file diff --git a/feedback/views.py b/feedback/views.py index ecd524478..e3a3f5461 100644 --- a/feedback/views.py +++ b/feedback/views.py @@ -23,9 +23,14 @@ class UserCommentAPI(ListCreateAPIView): def perform_create(self, serializer): serializer.save(user_id=self.request.user.id, comment=self.request.data['comment']) # updated after feedback -# class UserCommentUpdateAPI(UpdateAPIView): -# queryset = UserComment.objects.all() -# serializer_class = UserCommentSerializer +class UserCommentUpdateAPI(RetrieveUpdateDestroyAPIView): + queryset = UserComment.objects.all() + serializer_class = UserCommentSerializer + print('--------------------updatellllllllllllllll') + + # def perform_update(self, serializer): + # print('--------------------update') + # serializer.save(comment=self.request.data['comment']) diff --git a/front/src/components/cardLike.vue b/front/src/components/cardLike.vue index 1c029b3fe..6282b15aa 100644 --- a/front/src/components/cardLike.vue +++ b/front/src/components/cardLike.vue @@ -164,11 +164,19 @@ export default { } function proba() { + const feedObj = {} feedObj.comment = comment.value - axiosApiInstance.post(`api/feedback/userComment/`, feedObj) - // console.log(t_userComment.value, 't_userComment.value'); + if (t_userComment.value.length==0) { + axiosApiInstance.post(`api/feedback/userComment/`, feedObj) + } + else { + console.log('------------------yuiyui----/${t_userComment.value[0].id}------', ); + axiosApiInstance.put(`api/feedback/userCommentUp/${t_userComment.value[0].id}/`, feedObj) + } + + // console.log(t_userComment.value.length, 't_userComment.value'); } return {t_baseCriteria, tab_userComment, comment, average, feedAll, feedUp, menusCloses, myLabel, proba}