mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-17 18:09:25 +02:00
small cleanup
This commit is contained in:
parent
8644b0d456
commit
a3fa71659a
3 changed files with 17 additions and 22 deletions
|
@ -50,25 +50,11 @@ class DomainRequest(TimeStampedModel):
|
|||
def get_status_label(cls, status_name: str):
|
||||
"""Returns the associated label for a given status name"""
|
||||
return cls(status_name).label if status_name else None
|
||||
|
||||
|
||||
@classmethod
|
||||
def statuses_awaiting_review(cls):
|
||||
"""Returns all statuses that are awaiting a review from analysts"""
|
||||
return [
|
||||
cls.SUBMITTED,
|
||||
cls.IN_REVIEW
|
||||
]
|
||||
|
||||
# TODO - a better approach might be to just grab the value of source?
|
||||
# How??
|
||||
@classmethod
|
||||
def withdrawable_statuses(cls):
|
||||
"""Returns all statuses that are withdrawable"""
|
||||
return [
|
||||
cls.SUBMITTED,
|
||||
cls.IN_REVIEW,
|
||||
cls.ACTION_NEEDED
|
||||
]
|
||||
return [cls.SUBMITTED, cls.IN_REVIEW]
|
||||
|
||||
class StateTerritoryChoices(models.TextChoices):
|
||||
ALABAMA = "AL", "Alabama (AL)"
|
||||
|
@ -606,10 +592,6 @@ class DomainRequest(TimeStampedModel):
|
|||
"""Checks if the current status is in submitted or in_review"""
|
||||
return self.status in DomainRequest.DomainRequestStatus.statuses_awaiting_review()
|
||||
|
||||
def is_withdrawable(self):
|
||||
"""Helper function that determines if the request can be withdrawn in its current status"""
|
||||
return self.status in DomainRequest.DomainRequestStatus.withdrawable_statuses()
|
||||
|
||||
def get_first_status_set_date(self, status):
|
||||
"""Returns the date when the domain request was first set to the given status."""
|
||||
log_entry = (
|
||||
|
@ -1028,6 +1010,17 @@ class DomainRequest(TimeStampedModel):
|
|||
send_email=send_email,
|
||||
)
|
||||
|
||||
def is_withdrawable(self):
|
||||
"""Helper function that determines if the request can be withdrawn in its current status"""
|
||||
# This list is equivalent to the source field on withdraw. We need a better way to
|
||||
# consolidate these two lists - i.e. some sort of method that keeps these two lists in sync.
|
||||
# django fsm is very picky with what we can define in that field.
|
||||
return self.status in [
|
||||
self.DomainRequestStatus.SUBMITTED,
|
||||
self.DomainRequestStatus.IN_REVIEW,
|
||||
self.DomainRequestStatus.ACTION_NEEDED,
|
||||
]
|
||||
|
||||
@transition(
|
||||
field="status",
|
||||
source=[DomainRequestStatus.SUBMITTED, DomainRequestStatus.IN_REVIEW, DomainRequestStatus.ACTION_NEEDED],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue