2022-12-18 09:24:55 +01:00
|
|
|
from django import forms
|
|
|
|
from django.utils.translation import gettext as _
|
|
|
|
|
2022-12-27 22:09:10 +01:00
|
|
|
from .models import (
|
|
|
|
Image,
|
|
|
|
Gallery
|
|
|
|
)
|
2022-12-18 09:24:55 +01:00
|
|
|
|
|
|
|
class ImageUploadForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Image
|
2022-12-25 12:19:54 +01:00
|
|
|
fields = ['description', 'image_file', 'private', 'title']
|
|
|
|
labels = {
|
|
|
|
'private': 'Make this image private'
|
|
|
|
}
|
2022-12-27 22:09:10 +01:00
|
|
|
|
|
|
|
class GalleryCreatingForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Gallery
|
|
|
|
fields = ['title', 'private']
|
|
|
|
labels = {
|
|
|
|
'private': 'Make this gallery private'
|
|
|
|
}
|
|
|
|
|
|
|
|
images = forms.ImageField(
|
|
|
|
widget=forms.ClearableFileInput(attrs={'multiple': True})
|
|
|
|
)
|
|
|
|
|
|
|
|
class AccessCodeForm(forms.Form):
|
|
|
|
access_code = forms.CharField(max_length=32)
|
|
|
|
|
|
|
|
class VisitorNameForm(forms.Form):
|
|
|
|
name = forms.CharField(max_length=50)
|