Exemplo n.º 1
0
def set_public(request):
    if request.is_ajax():
        try:
            user = request.user
            tlid = request.POST.get('tlid')
            is_public = request.POST.get('is_public')
            from ninemitutil import str2bool
            is_public = str2bool(is_public)
            from timelist import set_public
            set_public(user, tlid, is_public)
        except Timelist.DoesNotExist, PermissionDenied:
            return JsonResponse({'ret':'err, no this list', 'valid': False})
        except PermissionDenied:
            return JsonResponse({'ret':'Permission Denied', 'valid': False})
Exemplo n.º 2
0
def set_tlistpanel_open(request):
    if request.is_ajax():
        try:
            user = request.user
            is_open = request.POST.get('is_open')
            if is_open is not None:
                from ninemitutil import str2bool
                is_open = str2bool(is_open)
                profile = user.get_profile()
                if profile.is_tlistpanel_open != is_open:
                    profile.is_tlistpanel_open = is_open
                    profile.save()
                    return JsonResponse({'ret':'OK'})
            return JsonResponse({'ret':'Not changed'})
        except PermissionDenied:
            return JsonResponse({'ret':'Permission Denied'})
Exemplo n.º 3
0
def set_on(request):
    if request.is_ajax():
        try:
            user = request.user
            reqdata = request.POST
            id = reqdata.get('tlid')
            on = reqdata.get('on')
            from ninemitutil import str2bool
            on = str2bool(on)
            from timelist import set_on
            set_on(user, id, on)
        except IndexError:
            ret='err, tlid wrong'
        except Timelist.DoesNotExist:
            ret='err, no this list'
        except PermissionDenied:
            ret='Permission Denied'
        else:
            ret='ok'
        return JsonResponse({'ret':ret})