Exemple #1
0
def list_albums(request, album):
    albums = Album.objects.filter(parent=album).order_by('name')
    parents = []
    images = None
    current_album = None
    if album is not None:
        current_album = Album.objects.get(id=album)
        images = Image.objects.filter(album=album)
        parents = list_parents(current_album)

    fotokonkurranse_album = Fotokonkurranse.objects.get().album
    context = {
        'album': album,
        'albums': albums,
        'albumpath': parents,
        'current_album': current_album,
        'images': images,
        'origin': request.get_full_path(),
        'all_users': sorted(User.sherpa_users(), key=lambda u: u.get_first_name()),
        'current_navigation': 'albums',
        'image_search_length': settings.IMAGE_SEARCH_LENGTH,
        'fotokonkurranse_album': fotokonkurranse_album,
        'album_download_part_count': Album.DOWNLOAD_PART_COUNT,
    }
    return render(request, 'common/admin/images/list_albums.html', context)
Exemple #2
0
def list_albums(request, album):
    albums = Album.objects.filter(parent=album).order_by("name")
    parents = []
    images = None
    current_album = None
    if album is not None:
        current_album = Album.objects.get(id=album)
        images = Image.objects.filter(album=album)
        parents = list_parents(current_album)

    fotokonkurranse_album = Fotokonkurranse.objects.get().album
    context = {
        "album": album,
        "albums": albums,
        "albumpath": parents,
        "current_album": current_album,
        "images": images,
        "origin": request.get_full_path(),
        "all_users": sorted(User.sherpa_users(), key=lambda u: u.get_first_name()),
        "current_navigation": "albums",
        "image_search_length": settings.IMAGE_SEARCH_LENGTH,
        "fotokonkurranse_album": fotokonkurranse_album,
        "album_download_part_count": Album.DOWNLOAD_PART_COUNT,
    }
    return render(request, "central/admin/images/list_albums.html", context)
Exemple #3
0
def content_json(request, album):
    if album is not None:
        current_album = Album.objects.get(id=album)
        objects = parse_objects(list_parents(current_album),
            Album.objects.filter(parent=album).order_by('name'),
            Image.objects.filter(album=album))
    else:
        objects = parse_objects([], Album.objects.filter(parent=None).order_by('name'), [])
    return HttpResponse(json.dumps(objects))
Exemple #4
0
def image_details(request, image):
    image = Image.objects.get(id=image)
    parents = [] if image.album is None else list_parents(image.album)
    exif = json.loads(image.exif)
    try:
        taken = datetime.strptime(exif['DateTime'], '%Y:%m:%d %H:%M:%S')
    except Exception:
        taken = None
    tags = image.tags.all()
    context = {
        'image': image,
        'albumpath': parents,
        'exif': exif,
        'taken': taken,
        'tags': tags,
        'origin': request.get_full_path(),
        'current_navigation': 'albums',
        'thumb_sizes': settings.THUMB_SIZES,
    }
    return render(request, 'central/admin/images/image_details.html', context)
Exemple #5
0
def image_details(request, image):
    image = Image.objects.get(id=image)
    parents = [] if image.album is None else list_parents(image.album)
    exif = json.loads(image.exif)
    try:
        taken = datetime.strptime(exif["DateTime"], "%Y:%m:%d %H:%M:%S")
    except Exception:
        taken = None
    tags = image.tags.all()
    context = {
        "image": image,
        "albumpath": parents,
        "exif": exif,
        "taken": taken,
        "tags": tags,
        "origin": request.get_full_path(),
        "all_users": sorted(User.sherpa_users(), key=lambda u: u.get_first_name()),
        "current_navigation": "albums",
        "thumb_sizes": settings.THUMB_SIZES,
    }
    return render(request, "central/admin/images/image_details.html", context)