query_fix_usertable does not work with postgres, and ignores the Y/N answer
when fixing the usertable, to adjust username length to 75 through query_fix_usertable(), 2 problems. First, the command doesn't work with postgres, and seconds, the answer (for Y/N) doesn't allow a N and doesn't check the answer.
This is the code I'm using to fix both those problems:
def query_fix_usertable(sender, app, created_models, verbosity, interactive, **kwargs): model_names = [m.name for m in created_models] if not interactive or app.name != 'django.contrib.auth.models' or "User" not in model_names: return
answer = raw_input(message) while not answer.lower() in ('y', 'n', 'yes', 'no'): answer = raw_input("You need to either decide yes ('y') or no ('n'). Default is no. (y/N): ") if answer.lower() == 'y': try: from django.db import connection cursor = connection.cursor() cursor.execute("ALTER TABLE auth_user MODIFY COLUMN username varchar(75) NOT NULL") except: #