python - Django login not working with custom user -
i have django project custom user (its this 1 can use email instead of username).
i creating ajax login keeps returning 500 error finding hard debug. code in view is:
@require_ajax def login(request): if request.method == 'post': email = request.post['email_address'] password = request.post['password'] print email, password user = authenticate(email=email, password=password) print user if user not none: if user.is_active: print 'starting work' login(request, user) print 'it worked' response = httpresponse(json.dumps({'code':'ok'}), content_type='application/json') else: response = httpresponse(json.dumps({'code':'inactive'}), content_type='application/json') else: print 'user none' response = httpresponse(json.dumps({'code':'notok'}), content_type='application/json') return response all parts work fine except 1 user active user , login(request, user) seems fail reason (i 'starting work' printed console not 'it worked'.
does know why might or can suggest how can exception shown in console?
the reason doesn't work because have named view login, same login() function builtin django. silly. renamed ajax_login , works expected.
Comments
Post a Comment