django-web-galleries/django_web_galleries/web_galleries/forms.py

33 lines
815 B
Python
Raw Normal View History

from django import forms
from django.utils.translation import gettext as _
from .models import (
Image,
Gallery
)
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'
}
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)