I figured it out!

The problem was that my custom zip code field's clean() function was
returning the profile object's *id*, not the actual zip code
instance.

>  zip_code_id = Postal_Code.objects.get(postal_code=value).id
>  return int(zip_code_id)

As it turns out, the function should have returned the actual object.
All I had to do to make this code work, therefore, was remove the
".id" from the end of the first line above. Voila!

Lesson learned: Custom fields for foreign keys must return an
instance, not the key.

Thanks again for the help. Hope this thread helps someone else in the
future.

Cheers,
LS



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