In Django, in the recommended configuration, the UserProfile instance is associated with OneToOneField with the User instance.
class UserProfile(models.Model):
user = models.OneToOneField(User)
data = ...
What is the most effective way to view both user and profile views? Is it possible to make a select_related () query on an inner join to get both objects with a single database hit? Or does it always boil down to two separate challenges? Perhaps Django auth middleware retrieves a user instance before invoking the view ... does anyone know?
source
share