I want to create new model, something like:
user_name = models.ForeignKey(u"Username", User),
but when I try to syncdb, I get this error message:
"AttributeError: 'unicode' object has no attribute '_meta'"
When I look on some tutorials, everything seems to be the same like in my model and problem with "_meta" is never mentioned.
A safer way to do this is to use the
AUTH_USER_MODEL
from the settings file.Example:
By default
settings.AUTH_USER_MODEL
refers todjango.contrib.auth.models.User
without requiring you to do anything.The advantage of this approach is that your app will continue to work even if you use a custom user model without modification.
For more information on how to make use of custom user models check out this part of the Django docs
You just want: