Hi, I've just made a new 'Student' model, and was trying to create a new Student in the admin interface, and I got the following error:
Environment: Request Method: POST Request URL: http://localhost:8000/admin/student/student/add/ Django Version: 1.0.2 final Python Version: 2.5.2 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'mysite.student'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware') Traceback: File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response 86. response = callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py" in root 157. return self.model_page(request, *url.split('/', 2)) File "/usr/lib/python2.5/site-packages/django/views/decorators/ cache.py" in _wrapped_view_func 44. response = view_func(request, *args, **kwargs) File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py" in model_page 176. return admin_obj(request, rest_of_url) File "/usr/lib/python2.5/site-packages/django/contrib/admin/ options.py" in __call__ 191. return self.add_view(request) File "/usr/lib/python2.5/site-packages/django/db/transaction.py" in _commit_on_success 238. res = func(*args, **kw) File "/usr/lib/python2.5/site-packages/django/contrib/admin/ options.py" in add_view 499. self.log_addition(request, new_object) File "/usr/lib/python2.5/site-packages/django/contrib/admin/ options.py" in log_addition 294. object_repr = force_unicode(object), File "/usr/lib/python2.5/site-packages/django/utils/encoding.py" in force_unicode 49. s = unicode(s) Exception Type: TypeError at /admin/student/student/add/ Exception Value: coercing to Unicode: need string or buffer, tuple found My model looks like this: from django.db import models from django.contrib.auth.models import User GENDER_CHOICES = ( ('m', 'male'), ('f', 'female'), ) # Create your models here. class Student(models.Model): # This is the only required field user = models.ForeignKey(User, unique=True) # Being nosey gender = models.CharField(max_length=1, choices=GENDER_CHOICES) birth_date = models.DateField() # Addressing details street_address = models.CharField(max_length=50, blank=False) suburb = models.CharField(max_length=20, blank=True) city = models.CharField(max_length=20, blank=False) post_code = models.PositiveSmallIntegerField(blank=False) # Contact details contact_phone = models.CharField(max_length=11, blank=False) cell_phone = models.CharField(max_length=11, blank=True) def __unicode__(self): return self.user.username, ", ", self.user.first_name, " ", self.user.last_name I'm quite new to Django, so aren't sure about what's going on at all. I appreciate any help people can give, Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---