From b04a681422c71b7e661a8d4c8d0e5de50dbc6738 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sun, 12 Jun 2011 12:44:47 -0400 Subject: [PATCH] blank=True is not enough to make models.ForeignKey optional, adding null=True too, thanks to Brian Huxley for finding this one --- apps/documents/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/documents/models.py b/apps/documents/models.py index 7b501b14bd..9d7feee408 100644 --- a/apps/documents/models.py +++ b/apps/documents/models.py @@ -53,7 +53,7 @@ class Document(models.Model): """ Defines a single document with it's fields and properties """ - document_type = models.ForeignKey(DocumentType, verbose_name=_(u'document type'), blank=True) + document_type = models.ForeignKey(DocumentType, verbose_name=_(u'document type'), null=True, blank=True) file = models.FileField(upload_to=get_filename_from_uuid, storage=STORAGE_BACKEND(), verbose_name=_(u'file')) uuid = models.CharField(max_length=48, default=UUID_FUNCTION(), blank=True, editable=False) file_mimetype = models.CharField(max_length=64, default='', editable=False)