FilePathField.allow_folders
Optional. Either True
or False
. Default is False
. Specifies whether folders in the specified location should be included. Either this or allow_files
must be True
.
Of course, these arguments can be used together.
The one potential gotcha is that match
applies to the base filename, not the full path. So, this example:
FilePathField(path="/home/images", match="foo.*", recursive=True)
...will match /home/images/foo.png
but not /home/images/foo/bar.png
because the match
applies to the base filename (foo.png
and bar.png
).
FilePathField
instances are created in your database as varchar
columns with a default max length of 100 characters. As with other fields, you can change the maximum length using the max_length
argument.
Please login to continue.