summaryrefslogtreecommitdiff
path: root/program/forms.py
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-04-15 18:41:03 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-04-15 18:41:03 (GMT)
commit17f110df8c14ea258d9227d08471a4a82bfa4657 (patch)
treef2aaf3e4bbf132fa3d0fbbbafca88a420f8225a7 /program/forms.py
parent1d521e1c65babb8412b4959bd476596e0aa36aa6 (diff)
parent179a462bf561dc0cb4d19133e7e3684055278296 (diff)
merged master into stable after new deployment
Diffstat (limited to 'program/forms.py')
-rw-r--r--program/forms.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/program/forms.py b/program/forms.py
index 0ecd371..9bfb7ad 100644
--- a/program/forms.py
+++ b/program/forms.py
@@ -1,15 +1,16 @@
-from django import forms
+from django.forms import ModelForm, ValidationError
from django.core.files.images import get_image_dimensions
from program.models import MusicFocus, ShowInformation, ShowTopic
-class FormWithButton(forms.ModelForm):
+
+class FormWithButton(ModelForm):
def clean_button(self):
button = self.cleaned_data.get('button')
if button:
width, height = get_image_dimensions(button)
if width != 11 or height != 11:
- raise forms.ValidationError("width or height is not 11, (11x11)")
+ raise ValidationError("width or height is not 11, (11x11)")
return button
def clean_button_hover(self):
@@ -17,7 +18,7 @@ class FormWithButton(forms.ModelForm):
if button_hover:
width, height = get_image_dimensions(button_hover)
if width != 11 or height != 11:
- raise forms.ValidationError("width or height is not 11, (11x11)")
+ raise ValidationError("width or height is not 11, (11x11)")
return button_hover
def clean_big_button(self):
@@ -25,18 +26,23 @@ class FormWithButton(forms.ModelForm):
if big_button:
width, height = get_image_dimensions(big_button)
if width != 17 or height != 17:
- raise forms.ValidationError("width or height is not 17, (17x17)")
+ raise ValidationError("width or height is not 17, (17x17)")
return big_button
+
class MusicFocusForm(FormWithButton):
class Meta:
model = MusicFocus
+ fields = '__all__'
+
class ShowInformationForm(FormWithButton):
class Meta:
model = ShowInformation
+ fields = '__all__'
+
class ShowTopicForm(FormWithButton):
class Meta:
model = ShowTopic
-
+ fields = '__all__'