0

I am trying to create a picture slideshow which will show all the png and jpg files of a folder using django.

Problem is how do I open windows explorer through django and prompt user to choose a folder name to load images from. Once this is done, how do I read all image files from this folder? Can I store all image files from this folder inside a list and pass this list in template views through context?

James Z
  • 12,209
  • 10
  • 24
  • 44
Amit Prafulla
  • 381
  • 2
  • 5

1 Answers1

0

This link “https://github.com/csev/dj4e-samples/tree/master/pics” shows how to store data into to database(sqlite is the database used here) using Django forms. But you cannot upload an entire folder at once, so you have to create a one to many model between display_id(This is just a field name in models you can name it anything you want) and pics. Now you can individually upload all pics in the folder to the same display _id and access all of them using this display_id. Also make sure to pass content_type for jpg and png separately while retrieving the pics.