Message instead of value err

This commit is contained in:
zandercymatics 2023-10-02 12:45:46 -06:00
parent f2184e5c37
commit cf0b342bbb
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7

View file

@ -721,9 +721,13 @@ class DomainAdmin(ListHeaderAdmin):
def do_delete_domain(self, request, obj):
if not isinstance(obj, Domain):
# Could be problematic if the type is similar,
# but not the same (same field/func names) so we err out.
# but not the same (same field/func names).
# We do not want to accidentally delete records.
raise ValueError("Object is not of type Domain")
self.message_user(
request, "Object is not of type Domain", messages.ERROR
)
return
try:
obj.deletedInEpp()
obj.save()