X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/38343a3fc11f5509c8522fec94c0ae7085b7244f..ee1de93724dbf4f81bf61742bd9798487bd5e3d0:/apps/explorer/models.py?ds=sidebyside diff --git a/apps/explorer/models.py b/apps/explorer/models.py index e69de29b..1f8e93dc 100644 --- a/apps/explorer/models.py +++ b/apps/explorer/models.py @@ -0,0 +1,14 @@ +import os + +from django.conf import settings + + +def get_image_folders(): + return sorted(fn for fn in os.listdir(os.path.join(settings.MEDIA_ROOT, settings.IMAGE_DIR)) if not fn.startswith('.')) + + +def get_images_from_folder(folder): + return sorted(settings.MEDIA_URL + settings.IMAGE_DIR + '/' + folder + '/' + fn for fn + in os.listdir(os.path.join(settings.MEDIA_ROOT, settings.IMAGE_DIR, folder)) + if not fn.startswith('.')) +