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

38 lines
954 B
Python

from django import forms
from django.utils.translation import gettext as _
from .models import (
Image,
Gallery
)
class ImageUploadForm(forms.ModelForm):
class Meta:
model = Image
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)
class ImageUploadForm(forms.Form):
images = forms.ImageField(
widget=forms.ClearableFileInput(attrs={'multiple': True})
)