comparison content/Coding/030-retiring-get-profile-and-auth-profile-module.rst @ 21:21a29f2520ca

Add related_name to UserProfile model example.
author Brian Neal <bgneal@gmail.com>
date Sat, 27 Aug 2016 13:18:54 -0500
parents fa54eda9b809
children
comparison
equal deleted inserted replaced
20:137650a0be4e 21:21a29f2520ca
82 from django.db import models 82 from django.db import models
83 from django.contrib.auth.models import User 83 from django.contrib.auth.models import User
84 84
85 class Profile(models.Model): 85 class Profile(models.Model):
86 """model to represent additional information about users""" 86 """model to represent additional information about users"""
87 user = models.OneToOneField(User) 87 user = models.OneToOneField(User, related_name='profile')
88 # ... other custom stuff here 88 # ... other custom stuff here
89 89
90 Update the code 90 Update the code
91 --------------- 91 ---------------
92 92