diff options
author | Filipp Lepalaan <filipp@mac.com> | 2015-12-05 14:27:15 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2015-12-05 14:27:15 +0200 |
commit | 98f2848dc4618e8f5373bcdf2b85dac3ee28db0c (patch) | |
tree | 3e3faa2295a820177b95977649d62a149bbebc45 /servo/forms | |
parent | ea3518103895ad380d531502e32b03edf14cde47 (diff) | |
download | Servo-98f2848dc4618e8f5373bcdf2b85dac3ee28db0c.tar.gz Servo-98f2848dc4618e8f5373bcdf2b85dac3ee28db0c.tar.bz2 Servo-98f2848dc4618e8f5373bcdf2b85dac3ee28db0c.zip |
Only accept HTML order templates
Diffstat (limited to 'servo/forms')
-rw-r--r-- | servo/forms/admin.py | 9 |
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: |