> Or can we perhaps even add an option to FilePathField that would
> refresh the choices each time? I'm not entirely sure how that would
> work... proxy function maybe?
That sounds like a reasonable idea to me, since doing it by default
could impose a serious performance hit. In it's most naive form (i.e.
making the 'choices' attribute a lazy list using
django.utils.functional.lazy) this wouldn't be too hard to implement.
However, that would mean that *every* time it was accessed it would have
to walk the file system to get the choices, which could easily get
crazy. A better solution would add some level of caching. This sounds
like we need an option that specifies the number of seconds to cache
for. It would be OK to require that there is a cache backend active for
this to work. We could have a single setting that controls the two e.g.
cache_paths_for - if it was None (the default) then it would cache forever.
Feel free to open a ticket for this.
Luke
--
A mosquito cried out in pain:
"A chemist has poisoned my brain!"
The cause of his sorrow
was para-dichloro-
diphenyltrichloroethane
Luke Plant || http://lukeplant.me.uk/