> Optional. Either `True` or `False`. Default is `True`. Specifies whether
files in the specified location should be included. Either this or
`allow_folders` must be `True`.
(analogue for allow_folders)
This seems to hint that one should set `allow_files` to True or
`allow_folders` to `True`; but not both at the same time.
In the corresponding code, it seems to say:
{{{
def _check_allowing_files_or_folders(self, **kwargs):
if not self.allow_files and not self.allow_folders:
return [
checks.Error(
"FilePathFields must have either 'allow_files' or
'allow_folders' "
"set to True.",
obj=self,
id="fields.E140",
)
]
return []
}}}
The code block thus checks that both parameters are not false (at the same
time).
It might be better to say "`allow_files` or `allow_folders` should be set
to True", since the either might hint that this is an exclusive or (based
on this post https://english.stackexchange.com/questions/13889/does-
either-a-or-b-preclude-both-a-and-b ).
This should then be both updated for the documentation, and for the error
codes I think.
--
Ticket URL: <https://code.djangoproject.com/ticket/33880>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by barrezuetai):
Hi Willem. The way I understand it is that ''at least'' one of the
attributes has to be True.
I haven't run the code myself, but it also seems like a user would only
run into this Error if they set both ''allow_files'' and ''allow_folders''
to false. In that scenario, the wording doesn't seem like too much a
problem.
--
Ticket URL: <https://code.djangoproject.com/ticket/33880#comment:1>