I have a couple of models whereby the admin interface is throwing up
some errors when I try add details to the user profile.
Each user will have a points score and belong to a team, which will
aggregate all the scores of those users belonging to that team.
My models look thus:
class Team(models.Model):
team = models.TextField(unique=True)
def __str__(self):
return self.team
class Admin:
pass
class UserProfile(models.Model):
score = models.IntegerField()
#team = models.ForeignKey(Team)
user = models.ForeignKey(User)
def __str__(self):
return self.user
class Admin:
pass
When I go to a user's profile in the admin interface I get the error:
TypeError at /admin/tables/userprofile/1/
__str__ returned non-string (type User)
Request Method: GET
Request URL: http://localhost:8000/admin/tables/userprofile/1/
Exception Type: TypeError
Exception Value: __str__ returned non-string (type User)
Exception Location:
/usr/lib/python2.5/site-packages/django/utils/encoding.py in
force_unicode, line 53
Template error
In template
/usr/lib/python2.5/site-packages/django/contrib/admin/templates/admin/change_form.html,
error at line 14
Caught an exception while rendering: __str__ returned non-string (type User)
The score is an integer, but it seems that the template is expecting a
string, when I definitely don't want it to be a string.
I would be grateful on any advice about how to implement the above.
TIA
Adam
--
You back your data up on the same planet?
http://www.monkeez.org
PGP key: 0x7111B833
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---