aboutsummaryrefslogtreecommitdiffstats
path: root/servo/forms
diff options
context:
space:
mode:
Diffstat (limited to 'servo/forms')
-rw-r--r--servo/forms/admin.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/servo/forms/admin.py b/servo/forms/admin.py
index 5118fc0..e69c12e 100644
--- a/servo/forms/admin.py
+++ b/servo/forms/admin.py
@@ -164,6 +164,15 @@ class QueueForm(BaseModelForm):
self.fields['status_dispatched'].queryset = queryset
self.fields['status_closed'].queryset = queryset
+ def clean_order_template(self):
+ from servo.lib.utils import file_type
+ tpl = self.cleaned_data.get('order_template')
+ ftype = file_type(tpl.file.read())
+ if ftype != 'text/html':
+ raise forms.ValidationError(_('Print tempates must be in HTML format'))
+
+ return tpl
+
class StatusForm(BaseModelForm):
class Meta: