Skip to content

Commit 3acf681

Browse files
committed
Changed view errors for ConcurrencyListEditableMixin
1 parent 9918d10 commit 3acf681

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/concurrency/admin.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -224,18 +224,19 @@ def message_user(self, request, message, *args, **kwargs):
224224
concurrency_errros = len(conflicts)
225225
if m:
226226
updated_record = int(m.group('num')) - concurrency_errros
227-
if updated_record == 0:
228-
message = _("No %(name)s were changed due conflict errors") % {'name': names[0]}
227+
228+
ids = ",".join(map(str, conflicts))
229+
messages.error(request,
230+
ungettext("Record with pk `{0}` has been modified and was not updated",
231+
"Records `{0}` have been modified and were not updated",
232+
concurrency_errros).format(ids))
233+
if updated_record == 1:
234+
name = force_text(opts.verbose_name)
229235
else:
230-
ids = ",".join(map(str, conflicts))
231-
messages.error(request,
232-
ungettext("Record with pk `{0}` has been modified and was not updated",
233-
"Records `{0}` have been modified and were not updated",
234-
concurrency_errros).format(ids))
235-
if updated_record == 1:
236-
name = force_text(opts.verbose_name)
237-
else:
238-
name = force_text(opts.verbose_name_plural)
236+
name = force_text(opts.verbose_name_plural)
237+
238+
message = None
239+
if updated_record > 0:
239240
message = ungettext("%(count)s %(name)s was changed successfully.",
240241
"%(count)s %(name)s were changed successfully.",
241242
updated_record) % {'count': updated_record,

0 commit comments

Comments
 (0)