. AUTH_PROFILE_MODEL. "Django in Depth". http://www.youtube.com/watch?v=t_ziKY1ayCo&feature=related 1 : 37 .
- , , BngGangOfFour.
- Model, UserProfile , .
BngGangOfFour/models.py
from django.contrib.auth.models import User
class UserProfile(models.Model):
user = models.OneToOneField(User)
last_ip_address = models.CharField(max_length=20, default="")
settings.py
....
AUTH_PROFILE_MODULE = 'BngGangOfFour.UserProfile'
....
BngGangOfFour/views.py
....
def index(request):
if request.user.get_profile().last_ip_address = "127.0.0.1":
print("why hello me!")
return render_to_response('index.html', locals(), context_instance=RequestContext(request))