My users are using e-mail addresses as usernames, which caused a problem in Django 1.9 because there was a 30 character maximum username length.
This was supposed to be fixed by Django 1.10, with a 150 character limit, I believe (though it looks like the docs actually say that max_length should be able to go up to 191 characters for certain databases).
I upgraded to Django 1.11 but username still seems to be limited to 30 characters. Is it because I need to set the value of max_length somewhere? If so, where do I set this (an example would be great)? If not, how do I increase the max length?
Here is my current view.
def register(request): alreadyRegistered = False invalidID = False context_dict = {} if request.method == 'POST': # Gather the username and password provided by the user. # This information is obtained from the login form. Userid = request.POST['username'] Userid = Userid[0:29] # horrible work-around that has to change if User.objects.filter(username=Userid).count() > 0: alreadyRegistered = True else: isGU = 1 > 0 # this will always = TRUE for now if isGU or isEA: firstname = request.POST['firstname'] lastname = request.POST['lastname'] email = Userid password = request.POST['password'] user = User.objects.create_user(Userid, email, password) user.first_name = firstname user.last_name = lastname user.save() registered = True user = authenticate(username=Userid, password=password) login(request, user) return HttpResponseRedirect('/studentprogress/') else: invalidID = True context_dict['alreadyRegistered'] = alreadyRegistered context_dict['invalidID'] = invalidID return render(request, 'studentprogress/register.html', context_dict)