On Mon, 2007-03-05 at 12:09 +0530, MacH G wrote:
> hi thanks Malcolm 
> i already have __str__ method on my Teacher class.
> its definition is 
> def __str__(self)
>    return self.name
>  
> where name is a CharField . we will be getting the name from the admin
> gui page 

I suspect I am misunderstanding what you mean when you talk about what
you see in your GUI, then -- and when I reread your original post, it
confirms that. Are you inserting the results of display_teacher()
directly into the template? If so, then the results you are seeing is to
be expected, because you are seeing Python's output of a list (it
doesn't automatically apply __str__ to the list contents). You would
need to loop over the contents of the list and insert them one at a time
(which would call __str__ as part of the printing portion).

Or you could change the display_teacher() method itself to map each of
the list contents through str() in order to return a list of strings.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to