-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_forms.py
57 lines (46 loc) · 1.33 KB
/
model_forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from django import forms
from django.utils.translation import ugettext_lazy as _
from . import models as photo_gallery_models
from . import conf as photo_gallery_conf
class Album(forms.ModelForm):
class Meta:
model = photo_gallery_models.Album
fields = (
'name',
'description',
)
labels = {
'name': _('Name'),
'description': _('Description'),
}
widgets = {
'name': forms.TextInput(attrs={'required': 'required'}),
'description': forms.Textarea(attrs={
'class': 'materialize-textarea',
}),
}
class Photo(forms.ModelForm):
class Meta:
model = photo_gallery_models.Photo
fields = (
'name',
'description',
'photo_image',
)
labels = {
'name': _('Name'),
'description': _('Description'),
'photo_image': _('Photo'),
}
widgets = {
'name': forms.TextInput(attrs={'required': 'required'}),
'description': forms.Textarea(attrs={
'class': 'materialize-textarea',
}),
}
class MultiplePhoto(forms.ModelForm):
class Meta:
model = photo_gallery_models.Photo
fields = (
'photo_image',
)