示例#1
0
    def post(self,request,*args,**kwargs):
        from managers.models import ModerationReport

        self.list = PhotoList.objects.get(uuid=self.kwargs["uuid"])
        if request.is_ajax() and not ModerationReport.is_user_already_reported(request.user.pk, 'PHL', self.list.pk):
            description = request.POST.get('description')
            type = request.POST.get('type')
            ModerationReport.create_moderation_report(reporter_id=request.user.pk, _type="PHL", object_id=self.list.pk, description=description, type=type)
            return HttpResponse()
        else:
            return HttpResponseBadRequest()
示例#2
0
    def post(self, request, *args, **kwargs):
        from managers.models import ModerationReport

        music = Music.objects.get(pk=self.kwargs["pk"])
        if request.is_ajax() and not ModerationReport.is_user_already_reported(
                request.user.pk, 'MUS', music.pk):
            ModerationReport.create_moderation_report(
                reporter_id=request.user.pk,
                _type="MUS",
                object_id=music.pk,
                description=request.POST.get('description'),
                type=request.POST.get('type'))
            return HttpResponse()
        else:
            return HttpResponseBadRequest()
示例#3
0
    def post(self, request, *args, **kwargs):
        from managers.models import ModerationReport

        form = ReportForm(request.POST)
        if request.is_ajax() and not ModerationReport.is_user_already_reported(
                request.user.pk, 'COM', self.kwargs["pk"]):
            mod = form.save(commit=False)
            ModerationReport.create_moderation_report(
                reporter_id=request.user.pk,
                _type="COM",
                object_id=self.kwargs["pk"],
                description=mod.description,
                type=request.POST.get('type'))
            return HttpResponse()
        else:
            return HttpResponseBadRequest()
示例#4
0
    def post(self, request, *args, **kwargs):
        from managers.models import ModerationReport

        comment = ElectNewComment.objects.get(pk=self.kwargs["pk"])
        if request.is_ajax() and not ModerationReport.is_user_already_reported(
                request.user.pk, 'ELEC', comment.pk):
            description = request.POST.get('description')
            type = request.POST.get('type')
            ModerationReport.create_moderation_report(
                reporter_id=request.user.pk,
                _type="ELEC",
                object_id=comment.pk,
                description=description,
                type=type)
            return HttpResponse()
        else:
            return HttpResponseBadRequest()