X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/38343a3fc11f5509c8522fec94c0ae7085b7244f..3ed251508dd18e0afc8f62bd18802e2e1c72737c:/apps/explorer/models.py diff --git a/apps/explorer/models.py b/apps/explorer/models.py index e69de29b..3b5848b7 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 [fn for fn in os.listdir(settings.IMAGE_DIR) if not fn.startswith('.')] + + +def get_images_from_folder(folder): + return ['/media/images/' + folder + '/' + fn for fn + in os.listdir(os.path.join(settings.IMAGE_DIR, folder)) + if not fn.startswith('.')] +