1f8e93dce01383601144585bc0df3c73026b7779
[redakcja.git] / apps / explorer / models.py
1 import os
2
3 from django.conf import settings
4
5
6 def get_image_folders():
7     return sorted(fn for fn in os.listdir(os.path.join(settings.MEDIA_ROOT, settings.IMAGE_DIR)) if not fn.startswith('.'))
8
9
10 def get_images_from_folder(folder):
11     return sorted(settings.MEDIA_URL + settings.IMAGE_DIR + '/' + folder + '/' + fn for fn 
12             in os.listdir(os.path.join(settings.MEDIA_ROOT, settings.IMAGE_DIR, folder))
13             if not fn.startswith('.'))
14