On 20-May-09, at 12:12 AM, neridaj wrote: > On May 19, 1:15 am, Ayaz Ahmed Khan <a...@ayaz.pk> wrote: >> On 19-May-09, at 5:12 AM, neri...@gmail.com wrote: >> >>> class Employee(models.Model): >>> user= models.ForeignKey(User, unique=True) >>> phone = PhoneNumberField() >>> ssn = models.CharField(max_length=11) >>> address = models.CharField(max_length=50) >>> city = models.CharField(max_length=30) >>> state = USStateField(default='WA') >>> zip_code = models.CharField(max_length=10) >> >>> def __unicode__(self): >>> return self.user.full_name >> >> Is there an attribute or property that goes by the name `full_name` >> defined on the Usermodel? As far as I can tell, no. You can, >> however, get to the full name associated with a User instance by >> calling the User.get_full_name() method. > > There are attributes for first_name and last_name, why wouldn't > user.first_name work? >
But not for User.full_name, which is what are trying to access (and subsequently failing while doing) in the __unicode__() method for the Employee class (if the code you pasted is anything to go by with). -- Ayaz Ahmed Khan The problem with any unwritten law is that you don't know where to go to erase it. -- Glaser and Way --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---