def like(self, request, pk=None): """ Like a model instance """ obj = self.get_object() services.add_like(obj, request.user) return Response()
def like(self, request, pk=None): obj = self.get_object() services.add_like(obj, request.user) return Response()
def question_like(request): add_like(Question.objects.get(0), request.POST.user)
def get(self, request, *args, **kwargs): post = self.get_object() services.add_like(post, request.user) return Response()
def add_like(request, slug=None): instance = get_object_or_404(Post, slug=slug) services.add_like(instance,request.user ) return redirect("posts_list")