Hi Django users

I have only been using python& django for about a week, so please
excuse me if this question sounds stupid.

Basically I have a model which extends the users model via a OneToOne
relationship like so:

class AgentProfile(models.Model):
        user =          models.OneToOneField(User)
        company =       models.ForeignKey(Company)
        is_admin =      models.BooleanField()
        phone   =       models.CharField(max_length=15)
        fax     =       models.CharField(max_length=15)

However my chanlenge  is that in the admin application on the Agent
profile list all profiles are displayed as "AgentProfile object"
Now I understand that I have to define a __unicode__ method in order
to generate the object "name"(excuse the terminology). However in this
instance I would like to display the first_name from the user object
but I cant seem to get it to work.

I have tried:

def __unicode__(self):
                return self.user.first_name


def __unicode__(self):
                return self.User.first_name


def __unicode__(User):
                return User.first_name

and a few other. I am not sure if this is at all possible or even
close to best practice or django standards,  some advice would be much
appreciated.

Rergards


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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