On 10/23/06, MerMer <[EMAIL PROTECTED]> wrote: > > In the example below I am trying to get list_display to show the the > "fullname" that was defined in def__str__(self). It's not working. > Can anybody tell me how I can do it. > > Many thanks > > MerMer
Try this: > class UserProfile(models.Model): > user=models.OneToOneField(User) > activation_key = models.CharField(maxlength=40) > key_expires = models.DateTimeField() > street_address=models.CharField(maxlength=400) > city_address= models.CharField(maxlength=100) > postcode=models.CharField(maxlength=50) def fullname(self): return "%s %s" %(self.user.first_name, self.user.last_name) def __str__(self): return self.fullname > class Admin: > list_display=('self.fullname','city_address','postcode') > pass > > Just understand that you can no longer sort by that column in admin. -- ---- Waylan Limberg [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---