Re: Help with List_display in Admin class

2006-10-23 Thread canen
MerMer, I think what you are looking for can be found in tutorial 2 (http://www.djangoproject.com/documentation/tutorial2/). In your case you could probable do: class UserProfile(models.Model): def fullname(self): return "%s %s" %(self.user.first_name,self.user.last_name) fullna

Re: Help with List_display in Admin class

2006-10-23 Thread MerMer
Thanks for the input - but I still can't get it to work. With the code as above I get an error saying the attribute "self.fullname" cannot be found. When I try "list_display = ('fullname') I get the following error "__str__ returned non-string (type instancemethod)". MerMer --~--~---

Re: Help with List_display in Admin class

2006-10-23 Thread Waylan Limberg
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.M

Re: Help with List_display in Admin class

2006-10-23 Thread orestis
try this: def _get_full_name(self): "Returns the person's full name." return '%s %s' % (self.first_name, self.last_name) full_name = property(_get_full_name) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Help with List_display in Admin class

2006-10-23 Thread orestis
AFAIK, to create instance variables, you have to define them in the __init__(self) function of your class. Defining them in other methods will not do. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" g

Help with List_display in Admin class

2006-10-23 Thread MerMer
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 class UserProfile(models.Model): user=models.OneToOneField(User) activation_key = models.