If you need to create a relationship on a model that has not yet been defined, you can use the name of the model, rather than the model object itself
UserSettings.objects.get(uid=uid)
возвращает объект класса UserSettings
. Вы можете получить данные из любого его атрибута:user_settings = UserSettings.objects.get(uid=uid)
print(user_settings.apikey)
print(user_settings.uid.username)
__str__
должен возвращать строковое представление объекта, а отношение OneToOne
- это не строка. type
в таблице вторая, то print(row[1])
cursor = mySQLconnection.cursor(dictionary=True)
...
for row in records:
print(row['type'])