示例#1
0
 def post(self, request, *args, **kwargs):
     form = SignUpForm(request.POST)
     if form.is_valid():
         UserSignUp.store(request)
         return tojson({'signup':True})
     else:
         return tojson({'signup':False, 
                 'message':'请正确填写表格'})
示例#2
0
def exists(request):
    """
    Does this user exists?
    args:
        request.POST['username']

    returns:
        json: {'exists':true/false}
    """
    res = {'exists':True}
    username = request.POST.get('username', '')
    if not username:
        return tojson(res)
    else:
        res['exists'] = UserSignUp.exists(username)
    return tojson(res)