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.
This commit is contained in:
Karl Hobley 2014-07-15 17:45:30 +01:00
parent 98db7956f2
commit 0cfc4ae94b
2 changed files with 4 additions and 3 deletions

View file

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

View file

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