diff --git a/db.sqlite3 b/db.sqlite3 index 391ebd891..a3883d211 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ 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}