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-248-6557 On Feb 10, 4:19 pm, Patrick Wellever <pwelle...@gmail.com> wrote: > Sorry, this question is turning out to be much more difficult to articulate > than I originally expected. Thanks for bearing with me. ;) > > You definitely have the right idea of what I'm trying to do -- the only > problem with this method is that Django looks for templates in multiple > places, so I don't actually know the absolute path to the directory the > templates are in. You quoted the critical bit from the docs in your earlier > message: if 'django.template.loaders.app_directories.Loader' is included in > your TEMPLATE_LOADERS setting, Django will search for a directory called > 'templates' in each installed app, *in addition to all the directories > specified in TEMPLATE_DIRS*, when trying to load a template. > > So if I have an app called 'myapp' and my settings.py contains this: > > TEMPLATE_DIRS = ('/home/django/templates',) > > TEMPLATE_LOADERS = ( > 'django.template.loaders.filesystem.Loader', > 'django.template.loaders.app_directories.Loader', > ) > > ... then both "/home/django/templates/myapp/" and > "/path/to/myapp/templates/myapp/" are legitimate places to stick the > templates for the app. I'm trying to find a solution that would list the > contents of my specified directory in either of these locations. > > I need something like: > > template_files = [] > for dir in EVERY_DIRECTORY_DJANGO_LOOKS_FOR_TEMPLATES_IN: > template_files.extend(os.listdir(dir)) > > I have to agree about the spoken word, though... Happy to discuss this by > phone if you'd like, and thanks again for your help. > > - Patrick > > On Fri, Feb 10, 2012 at 3:25 PM, Python_Junkie < > > > > > > > > software.buy.des...@gmail.com> wrote: > > The internet is a wonderful invention, but sometimes the interchange > > of the spoken word is more efficient. > > > Let's see if I have this straight. > > > You know which directory the templates are in. > > > 'templates/flatpages/page_templates/ for example. > > Is that correct? > > > Then when you pass from the url.py to the specific view that you are > > directed to by the url you simply call the function > > ********************************************************* > > files=os.listdir('templates/flatpages/page_templates/ ') > > > template_qty=len(files) > > > for xxx in range(template_qty): > > #####perform the logic to add values to the dictionary > > template_dictionary=( a:'a',b:'b') ### I forget the > > exact syntax > > > render(form_template_listing.html,template_dictionary) - ## I > > forget the exact syntax > > > ****************************************************** > > > Then in the form_template_listing.html , template unpack the template > > dictionary in the drop down list. > > > I believe this is what you are asking. > > > If not I can send you my cell phone number and we can discuss it. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.