Pass image_id into confirmation.json (as it was before)

This is because when the image is deleted, the ID gets unassigned. So "None" gets inserted into the response JSON.
pull/428/head
Karl Hobley 2014-07-15 17:45:30 +01:00
rodzic 98db7956f2
commit 0cfc4ae94b
2 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -1,5 +1,5 @@
{ {
"image_id": {{ image.id }}, "image_id": {{ image_id }},
{% if form %} {% if form %}
"form": "{% filter escapejs %}{% include 'wagtailimages/multiple/edit_form.html' %}{% endfilter %}", "form": "{% filter escapejs %}{% include 'wagtailimages/multiple/edit_form.html' %}{% endfilter %}",
{% endif %} {% endif %}

Wyświetl plik

@ -56,11 +56,12 @@ def edit(request, image_id, callback=None):
form.save() form.save()
return render(request, 'wagtailimages/multiple/confirmation.json', { return render(request, 'wagtailimages/multiple/confirmation.json', {
'success': True, 'success': True,
'image': image, 'image_id': image_id,
}, content_type='application/json') }, content_type='application/json')
else: else:
return render(request, 'wagtailimages/multiple/confirmation.json', { return render(request, 'wagtailimages/multiple/confirmation.json', {
'success': False, 'success': False,
'image_id': image_id,
'image': image, 'image': image,
'form': form, 'form': form,
}, content_type='application/json') }, content_type='application/json')
@ -81,6 +82,6 @@ def delete(request, image_id):
return render(request, 'wagtailimages/multiple/confirmation.json', { return render(request, 'wagtailimages/multiple/confirmation.json', {
'success': True, 'success': True,
'image': image, 'image_id': image_id,
}, content_type='application/json') }, content_type='application/json')