Skip to main content

get_default_username

Try to determine the current system user's username to use as a default.

def get_default_username(
check_db: boolean = True,
database: string = DEFAULT_DB_ALIAS
) - > string

Try to determine the current system user's username to use as a default.

Parameters

NameTypeDescription
check_dbboolean = TrueIf True, requires that the username does not match an existing auth.User (otherwise returns an empty string).
databasestring = DEFAULT_DB_ALIASThe database where the unique check will be performed.

Returns

TypeDescription
stringThe username, or an empty string if no username can be determined or the suggested username is already taken.