On 6/28/07, JimR <[EMAIL PROTECTED]> wrote: > > below. When I include the 'def __str__(self)' it displays the user id > in the admin interface, but when I access the record I get an error > "__str__ returned non-string (type Userid)"
The error message is telling you the exact problem. Your __str__ defintion: > def __str__(self): > return self.user_id Is not returning a string. self.user_id is not a string, it is an integer. If you change this to return a string, the error will go away. You have a number of options. any of the following would work: return str(self.user_id) # Return the user ID number as a string return str(self.user) # Return the stringified version of the user return self.user.username # Return the users username, which is a string. There are many other alternatives - it just depends what you want to display. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---