Yes it looks that:
from django.db import models
from django.contrib.auth.models import User

class UserProfile(models.Model):
    user = models.ForeignKey(User, unique=True)
    register_hash = models.CharField(max_length=32)

And now I want to do something like this:
    check = User.objects.all()

    for x in check:
        print x.userprofile.register_hash

And I get :
'User' object has no attribute 'userprofile'

On 25 Lis, 14:43, bruno desthuilliers <bruno.desthuilli...@gmail.com>
wrote:
> On 25 nov, 12:55, robos85 <prog...@gmail.com> wrote:
>
> > I'm wondering how to confirm user by ref_hash and email. I know how to
> > check by ref_hash in my UserProfile model but have no idea how to
> > connect users model with my UserProfile model.
> > It's required because I'm checking email (Users) and reg_hash
> > (UserProfile).
>
> > How to resolve it?
>
> Your UserProfile has a key to User, does it ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to