Good morning all, This problem sure seems like a bug, but it's such a common operation that I must be doing something wrong. I am using the admin interface to add a new student to my database. At the same time I also want to add the parents of the student, so I click on the "+" icon on the student page to add the data for the parents. The data for the parents saves fine, but when I click to save the student I always get an error (copied below). If I do the operation in two steps, adding the parent first then going to the student page and adding the student linked to the parents, everything works fine. In fact, if I simply click back from the error page to the student page I submitted from, click reload so the parent now appears in the select box, select the parent and then click save everything works too.
Looking at the traceback, it appears the value of the field for the ForeignKey in the student that points to the parent has a value of u"None" when I suppose that it should have an integer value that points the parent primary key. Anyway, I'm not expert here, but I hope that someone can help out. This operation seems so common that I must be doing something wrong. Cheers, Ben Environment: Request Method: POST Request URL: http://www.moviemago.com/admin/students/aluno/add/ Django Version: 1.0-final-SVN-unknown Python Version: 2.4.3 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'ETF.students', 'django.contrib.admin'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware') Traceback: File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py" in get_response 86. response = callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python2.4/site-packages/django/contrib/admin/sites.py" in root 158. return self.model_page(request, *url.split('/', 2)) File "/usr/lib/python2.4/site-packages/django/views/decorators/ cache.py" in _wrapped_view_func 44. response = view_func(request, *args, **kwargs) File "/usr/lib/python2.4/site-packages/django/contrib/admin/sites.py" in model_page 177. return admin_obj(request, rest_of_url) File "/usr/lib/python2.4/site-packages/django/contrib/admin/ options.py" in __call__ 191. return self.add_view(request) File "/usr/lib/python2.4/site-packages/django/db/transaction.py" in _commit_on_success 238. res = func(*args, **kw) File "/usr/lib/python2.4/site-packages/django/contrib/admin/ options.py" in add_view 490. if form.is_valid(): File "/usr/lib/python2.4/site-packages/django/forms/forms.py" in is_valid 120. return self.is_bound and not bool(self.errors) File "/usr/lib/python2.4/site-packages/django/forms/forms.py" in _get_errors 111. self.full_clean() File "/usr/lib/python2.4/site-packages/django/forms/forms.py" in full_clean 224. value = field.clean(value) File "/usr/lib/python2.4/site-packages/django/forms/models.py" in clean 650. value = self.queryset.get(**{key: value}) File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in get 297. clone = self.filter(*args, **kwargs) File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in filter 483. return self._filter_or_exclude(False, *args, **kwargs) File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in _filter_or_exclude 501. clone.query.add_q(Q(*args, **kwargs)) File "/usr/lib/python2.4/site-packages/django/db/models/sql/query.py" in add_q 1224. can_reuse=used_aliases) File "/usr/lib/python2.4/site-packages/django/db/models/sql/query.py" in add_filter 1167. self.where.add((alias, col, field, lookup_type, value), connector) File "/usr/lib/python2.4/site-packages/django/db/models/sql/where.py" in add 48. params = field.get_db_prep_lookup(lookup_type, value) File "/usr/lib/python2.4/site-packages/django/db/models/fields/ __init__.py" in get_db_prep_lookup 202. return [self.get_db_prep_value(value)] File "/usr/lib/python2.4/site-packages/django/db/models/fields/ __init__.py" in get_db_prep_value 671. return int(value) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---