mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-21 10:16:13 +02:00
cleanup
This commit is contained in:
parent
6dd4132a29
commit
d723825b12
1 changed files with 6 additions and 13 deletions
|
@ -2014,21 +2014,14 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
||||||
return (obj, should_proceed)
|
return (obj, should_proceed)
|
||||||
|
|
||||||
obj_is_not_approved = obj.status != models.DomainRequest.DomainRequestStatus.APPROVED
|
obj_is_not_approved = obj.status != models.DomainRequest.DomainRequestStatus.APPROVED
|
||||||
original_obj_is_not_approved = original_obj.status != models.DomainRequest.DomainRequestStatus.APPROVED
|
|
||||||
if obj_is_not_approved and not obj.domain_is_not_active():
|
if obj_is_not_approved and not obj.domain_is_not_active():
|
||||||
# If an admin tried to set an approved domain request to
|
# REDUNDANT CHECK / ERROR SCREEN AVOIDANCE:
|
||||||
# another status and the related domain is already
|
# This action (moving a request from approved to
|
||||||
# active (READY), shortcut the action and throw a friendly
|
# another status when the domain is already active (READY),
|
||||||
# error message. This action would still not go through
|
# would still not go through even without this check as the rules are
|
||||||
# shortcut or not as the rules are duplicated on the model,
|
|
||||||
# but the error would be an ugly Django error screen.
|
|
||||||
error_message = "This action is not permitted. The domain is already active."
|
|
||||||
if original_obj_is_not_approved and Domain.objects.filter(name=original_obj.requested_domain.name).exists():
|
|
||||||
# REDUNDANT CHECK:
|
|
||||||
# This action (approving a request when the domain is active)
|
|
||||||
# would still not go through check or not as the rules are
|
|
||||||
# duplicated in the model and the error is raised from the model.
|
# duplicated in the model and the error is raised from the model.
|
||||||
error_message = FSMDomainRequestError.get_error_message(FSMErrorCodes.APPROVE_DOMAIN_IN_USE)
|
# This avoids an ugly Django error screen.
|
||||||
|
error_message = "This action is not permitted. The domain is already active."
|
||||||
elif obj.status == models.DomainRequest.DomainRequestStatus.REJECTED and not obj.rejection_reason:
|
elif obj.status == models.DomainRequest.DomainRequestStatus.REJECTED and not obj.rejection_reason:
|
||||||
# This condition should never be triggered.
|
# This condition should never be triggered.
|
||||||
# The opposite of this condition is acceptable (rejected -> other status and rejection_reason)
|
# The opposite of this condition is acceptable (rejected -> other status and rejection_reason)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue