tweak to validator message. passing through max size vars

This commit is contained in:
Dave Cranwell 2014-10-07 16:06:20 +01:00 committed by Karl Hobley
parent 5999e96505
commit 50f8aed9c3
3 changed files with 3 additions and 1 deletions

View file

@ -15,6 +15,7 @@ $(function(){
sequentialUploads: true,
dropZone: $('.drop-zone'),
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
maxFileSize: window.max_file_size,
previewMinWidth:150,
previewMaxWidth:150,
previewMinHeight:150,

View file

@ -69,6 +69,7 @@
{% url 'wagtailadmin_tag_autocomplete' as autocomplete_url %}
<script>
window.max_file_size = {{ max_filesize }};
window.simple_upload_url = "{% url 'wagtailimages_add_image' %}";
window.tagit_opts = {
autocomplete: {source: "{{ autocomplete_url|addslashes }}"}

View file

@ -16,7 +16,7 @@ def validate_image_format(f):
extension = 'jpeg'
if extension not in ['gif', 'jpeg', 'png']:
raise ValidationError(_("Not a valid image. Please use a gif, jpeg or png file with the correct file extension (*.gif, *.jpg or *.png)."))
raise ValidationError(_("Not a supported image type. Please use a gif, jpeg or png file with the correct file extension (*.gif, *.jpg or *.png)."))
if not f.closed:
# Open image file