In addition, I checked my mysql table and the field in question is implemented as an integer with Null allowed and default set to Null, so it appears that syncdb is creating the table properly, but the admin interface is not letting me put in a null value for some reason.
Thanks Iain Iain Duncan wrote: > The Django sites related-objects documentation says: > > "if a ForeignKey field has null=True set (i.e., it allows NULL values), > you can assign None to it. Example: > > e = Entry.objects.get(id=2) > e.blog = None > e.save() # "UPDATE blog_entry SET blog_id = NULL ...;" > > But I can't figure out how to set it so that the admin interface will > allow creation of an object with an empty foreign key field. > > I have tried: > > foo = models.ForeignKey( bar, null=True ) > foo = models.ForeignKey( bar, null=True, blank=True ) > foo = models.ForeignKey( bar, null=True, default=None ) > > They all seem to build ok, but in the admin interface you still can't > set up an object without picking one of the 'bar' objects in the drop > down. Anyone have any idea how to get it to work ok with null values? I > realize this isn't great database design, but it greatly simplifies > building the admin interface for an otherwise simple database. > > Thanks > Iain > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---