An AJAX registration attempt results in an AttributeError when manually setting the backend property.
def ajax_signup_view(request):
if request.method == 'POST':
form_obj = CustomSignupForm(request.POST)
if form_obj.is_valid():
new_user = form_obj.save(commit=False)
new_user.username = abs(hash(new_user.email))
new_user.auth_method = 'django.contrib.auth.backends.ModelBackend'
new_user.save()
return HttpResponse('Success')
return HttpResponse('Error')
Why does this error occur only during AJAX calls?