Hi! I have a problem. I'm dealing with a legacy database where some of the foreign keys aren't pointing to the right place because 0 (and -1) has been used in some places instead of NULL. I can't fix the rows as the new application will have to live side by side with the legacy system for some time.
The problem is that if I try to access foo.bar in any way, Django tries to lookup a bar with id 0 or -1 and throws an exception. My forms break, and the serializers break, making it hard to write test code. Does anyone know of an easy way to get around this? I had a brief look at the ForeignKey code, but it's not immediately obvious how to add a little hook to fix this, I'd hoped I could just convert 0 and -1 to None before the values get to Django. If it weren't for the problem with forms and serializers, I think I'd just write a little helper function and never use the field itself. Ole -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.