Since my last question here: http://stackoverflow.com/questions/3166221/python-images-display
I understood that from all the answers I got the glob.glob could be the only one in the direction I need.
However where I am stuck right now is here:
I can create a list with all the filenames in my media directory by using glob.glob:
all = glob.glob("/Path_to_MEDIA/*/*.jpg")
But how can I use that and create a VERY SIMPLE image display with one next button that calls files in my MEDIA_ROOT and displays them.
What I know is:
I have a Template which looks something like the default directory index:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="en-us" /> <meta name="robots" content="NONE,NOARCHIVE" /> <title>Index of {{ directory }}</title> </head> <body> <h1>Index of {{ directory }}</h1> <ul> {% ifnotequal directory "/" %} <li><a href="../">../</a></li> {% endifnotequal %} {% for f in file_list %} <li><a href="{{ f|urlencode }}">{{ f }}</a></li> {% endfor %} </ul> </body> </html>
I need to create a def in my views that feeds the list from glob.glob to this or similar template.
What I dont know:
- How does this def in the view have to look like?
And here:
- What do I have to write to display one image, sound in a browser?
- What do I have to write to display a LIST of images, sounds?
Thanks for the time!