Created
June 1, 2011 19:59
-
-
Save sjl/1003164 to your computer and use it in GitHub Desktop.
Allow empty values in FileBrowseField's with blank=True, null=False
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/filebrowser/fields.py b/filebrowser/fields.py | |
--- a/filebrowser/fields.py | |
+++ b/filebrowser/fields.py | |
@@ -96,10 +96,12 @@ | |
return FileObject(url_to_path(value)) | |
def get_db_prep_value(self, value, connection, prepared=False): | |
if value is None: | |
return None | |
+ if not value: | |
+ return value | |
return value.url_save | |
def formfield(self, **kwargs): | |
attrs = {} | |
attrs["directory"] = self.directory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment