Reputation: 4743
I've defined a Django model which makes use of FilePathField(allow_files=False, allow_folders=True)
which shall allow to define a required (not optional) file system directory in the model. If I try to add a new model in the admin interface I get a file not found error. All my other models registered the same way are just working fine. If I'd use CharField()
instead of FilePathField()
to hold the file system directory path I'd simply define a default value like CharField(default='')
.
How can I fix the model making use of the FilePathField
field?
Upvotes: 2
Views: 877
Reputation: 332
I have encountered same problem and the cause of the error is that django tries to scan the directory in order to get list of files that will be displayed as choices in html widget. There are few solutions.
path=/some/dir
to FilePathField
editable=False
in FilePathField
Upvotes: 3