Yes, the ModelAdmin is registered with django.contrib.admin.site. And
the change and add pages for the model are displaying correctly. It
even provides the expected error message if I enter an invalid Zip
code.

But when I enter a correct Zip code and Save, it gives me an Integrity
Error:

-----------

IntegrityError at /admin/profile/profile/2/
null value in column "zip_code_id" violates not-null constraint

TRACEBACK

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/core/handlers/base.py in get_response
                response = callback(request, *callback_args,
**callback_kwargs) ...
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/contrib/admin/sites.py in root
            return self.model_page(request, *url.split('/', 2)) ...
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/contrib/admin/sites.py in model_page
        return admin_obj(request, rest_of_url) ...
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/contrib/admin/options.py in __call__
            return self.change_view(request, unquote(url)) ...
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/contrib/admin/options.py in change_view
                return self.save_change(request, model, form,
inline_formsets) ...
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/contrib/admin/options.py in save_change
        new_object = form.save(commit=True) ...
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/newforms/models.py in save
        return save_instance(self, instance, fields, fail_message,
commit) ...
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/newforms/models.py in save_instance
        instance.save() ...
/Users/leifstrickland/Sites/DjangoProject/mysite2/../mysite2/profile/
models.py in save
                super(Profile, self).save()      ...
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/db/models/base.py in save
                        db_values + [pk_val]) ...
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/db/backends/util.py in execute
            return self.cursor.execute(sql, params) ...

-----------

In the last step, the local db_values var is a tuple of values to be
used in the DB query. All values are correct except for the
zip_code_id, which is None. That shouldn't be the case, because the
zip code field's clean() function has worked properly (i.e., returned
the corresponding zip_code_id) in shell and admin testing. So somehow
the value returned by the clean() function is being overwritten or
ignored later in the script. I just can't figure it out.

Thanks again for all the help.


--~--~---------~--~----~------------~-------~--~----~
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