Commit 85b23793 authored by Wietse Kuipers's avatar Wietse Kuipers
Browse files

Constrain album cover selection to photos from album

parent 661d107a
......@@ -10,6 +10,15 @@ from .models import Album, Photo
class AlbumForm(forms.ModelForm):
# Excuse my french
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if 'instance' in kwargs:
self.fields['_cover'].queryset = Photo.objects.filter(
album_archive = forms.FileField(
help_text="Uploading a zip file adds all contained images as photos.",
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment