Example #1
0
    def make_approve(self, request, queryset):
        for obj in queryset:
            Post.objects.filter(pk=obj.id)\
                .update(status=Post.APPROVED, timestamp=time.time())

        for obj in queryset:
            send_notif(user=obj.user, type=Notif.APPROVE, post=obj, actor=request.user)
Example #2
0
    def fault(self, request, queryset):
        for obj in queryset:
            Post.objects.filter(pk=obj.id).update(status=Post.FAULT, report=0)
            #print obj.status
            #obj.status = Post.FAULT
            #print obj.status
            #obj.save()

            user = obj.user
            user.profile.fault = user.profile.fault+1
            user.profile.save()

        for obj in queryset:
            send_notif(user=obj.user, type=Notif.FAULT, post=obj, actor=request.user)