Changed message logic so that a message is displayed per document and not per document group
This commit is contained in:
@@ -776,15 +776,14 @@ def document_clear_transformations(request, document_id=None, document_id_list=N
|
||||
|
||||
if request.method == 'POST':
|
||||
for document in documents:
|
||||
for document_page in document.documentpage_set.all():
|
||||
for transformation in document_page.documentpagetransformation_set.all():
|
||||
transformation.delete()
|
||||
try:
|
||||
for document_page in document.documentpage_set.all():
|
||||
for transformation in document_page.documentpagetransformation_set.all():
|
||||
transformation.delete()
|
||||
messages.success(request, _(u'All the page transformations for document: %s, have been deleted successfully.') % document)
|
||||
except Exception, e:
|
||||
messages.error(request, _(u'Error deleting the page transformations for document: %s; %s.') % (document, e))
|
||||
|
||||
if len(documents) == 1:
|
||||
messages.success(request, _(u'All the page transformations for document: %s, have been deleted successfully.') % ', '.join([unicode(d) for d in documents]))
|
||||
elif len(documents) > 1:
|
||||
messages.success(request, _(u'All the page transformations for the documents: %s, have been deleted successfully.') % ', '.join([unicode(d) for d in documents]))
|
||||
|
||||
return HttpResponseRedirect(next)
|
||||
|
||||
context = {
|
||||
|
||||
Reference in New Issue
Block a user