문제

The Error -

"Caught FieldError while rendering: Cannot resolve keyword 'user' into field.
 Choices 
are: id, is_active_online, person"

The Model -

AUTH_PROFILE_MODULE = 'account.UserProfile'

class UserProfile(models.Model):
    person      = models.OneToOneField(User)
    is_active_online = models.NullBooleanField(null = True, default = None)

The Origin of the error from a template -

{{ user_object.get_profile.is_active_online }}

What could be the issue?

도움이 되었습니까?

해결책

https://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users

To make use of this feature, define a model with fields for the additional information you'd like to store, or additional methods you'd like to have available, and also add a OneToOneField named user from your model to the User model.

Your OneToOneField needs to be named user

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top