mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-25 22:03:10 +00:00
format wasn't good at all ^^ + add many
support
This commit is contained in:
parent
cf5a481d6a
commit
4d15ad99f1
1 changed files with 22 additions and 10 deletions
|
@ -380,15 +380,27 @@ def get_input_formats_help_text(input_formats):
|
||||||
return help_text
|
return help_text
|
||||||
|
|
||||||
|
|
||||||
|
# TODO : Use verbose names
|
||||||
def messages_protected_error(messages, request, item, error):
|
def messages_protected_error(messages, request, item, error):
|
||||||
"""Add an error message, specific to ProtectedError exception."""
|
"""Add an error message, specific to ProtectedError exception."""
|
||||||
messages.error(
|
if len(error.protected_objects) > 1:
|
||||||
request,
|
messages.error(
|
||||||
_("[{item_class_name}] {item_name} can't be deleted \
|
request,
|
||||||
because it is used by [{foreign_class_name}] {foreign_name}."format({
|
_("[{item_classname}] {item_name} can't be deleted \
|
||||||
'item_class_name': item.__class__.__name__,
|
because it it used by many [{foreign_classname}].".format(
|
||||||
'item_name': item.name,
|
item_classname=item.get_classname(),
|
||||||
'foreign_class_name': error.protected_objects[0].__class__.__name__,
|
item_name=item,
|
||||||
'foreign_name': error.protected_objects[0].name,
|
foreign_classname=error.protected_objects[0].get_classname()
|
||||||
})
|
))
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
messages.error(
|
||||||
|
request,
|
||||||
|
_("[{item_classname}] {item_name} can't be deleted \
|
||||||
|
because it is used by [{foreign_classname}] {foreign_name}.".format(
|
||||||
|
item_classname=item.get_classname(),
|
||||||
|
item_name=item,
|
||||||
|
foreign_classname=error.protected_objects[0].get_classname(),
|
||||||
|
foreign_name=error.protected_objects[0]
|
||||||
|
))
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in a new issue