Michael, Thanks for your reply!
> Many databases will allow a constraint with a foreign key to be deferrable > and initially deferred so that you don't have to disable the relationship > to load data. Can you say a bit more about this? I'm by no means an expert on databases; I'm not quite sure what "deferable" means. > But a nullable foreign key? Not likely. Anyway, Django is trying to > store a null value into the FK, which is definitely a flaw. The value > should only be deferred. That is a flaw in your setup and also a flaw in > Django. It should not permit the setup for storing null values into a FK. > The proper way to handle that is to make one entry that is a 'default' or > 'unknown' in supplier, with a genuine key, and let that be the value > stored for the FK if you are uncomfortable with a deferred FK. > Just remember that a FK implies that there is always one supplier which > may supply many items. If there are several suppliers which can supply > one item, and several items available from a single supplier, a > ManyToManyField is appropriate. Using an "unknown" record as the default sounds like it might be the way to go for me. A ManyToManyField is not appropriate in this case; there should never be more than one supplier for a Title, but the same Contact might be the supplier for many Titles. My goal in setting null=True was basically to allow soft validation: I want to be able to save a Title record without a supplier and fix it later (in case I'm importing dicey-looking data), but I don't want to allow *more* than one supplier. If that's not possible, or not good practice, a default of an unknown contact seems like the next best thing. What's the appropriate way to go about creating an "unknown" Contact record (particularly if I don't want it to be user-editable)? I assume this means I must instantiate Contact and save() the instance before the Title model is ever parsed by Django...I smell a catch-22 in the works if I need to do this for any other fields. Thanks again for your help. Richard --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---