I'm interested in this also.
I too have my own static pages app and have always thought it would be
easier for folks to choose from a list of files rather than have to
remember what's there on the file system.
I suppose one way to do it would be to create an FK to another model
what someone has entered the paths to available templates... But, I do
like the idea of reading the contents of a folder and having a
dropdown that updates dynamically (with code portability in mind).
Patrick, if you find a solution please post it back here to the list.
I will do the same.
Thanks!
M
> I want to make it a choice field that justs lists all the files in, for example,
> 'templates/flatpages/page_templates/', so the user can see what templates are available and just
> choose one from a select list.
you can read the filesystem in the form's (or form field's) __init__.
I think you have it with the syntax you just wrote down.
I will be available by phone until 4:45 if you want to call.
781-...
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
for loader in settings.TEMPLATE_LOADERS:loader_module = importlib.import_module('.'.join(loader.split('.')[:-1]))print '\n'.join(source for source in loader_module.Loader().get_template_sources(''))
from django.template.loader import find_template_loader
for loader_name in settings.TEMPLATE_LOADERS:
loader = find_template_loader(loader_name)
loader.get_template_sources('') # etc