Answer the question
In order to leave comments, you need to log in
How to refer to a related model field using django-allauth in a template?
I have an authorization through a social network. The Profile(additional information about the user) model has a OneToOneField() relationship with the User(authorization data) model. How do I render fields from the Profile model when only {% load socialaccount %} account information from django-allauth is passed to the template? Thanks in advance.
Answer the question
In order to leave comments, you need to log in
Use related_name to access the related model.
class Profile(models.model):
user = models.OneToOneField("User",on_delete = ...., related_name = 'profile')
....
class Profile(models.Model):
....
class Meta:
default_related_name = 'profile'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question