I have a model, which has FilePathField attribute. It has a folder to search, regular expression to match and other needed parameters.
I need a standard method to get the list of all available for this FilePathField paths. Or it does not exist?
No, there isn't one. You can write your own using path, match and recursive. However, this is how the admin widget form for FilePathField gets all the paths - https://github.com/django/django/blob/master/django/forms/fields.py#L999
from django.forms.fields import FilePathField
a = FilePathField(path='/path')
print a.choices
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With