mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-17 18:09:25 +02:00
tweaks + cleanup on normal view
This commit is contained in:
parent
01ce2fb8a4
commit
e5a011c039
2 changed files with 32 additions and 5 deletions
|
@ -12,6 +12,7 @@ from registrar.models.federal_agency import FederalAgency
|
||||||
from registrar.models.utility.generic_helper import CreateOrUpdateOrganizationTypeHelper
|
from registrar.models.utility.generic_helper import CreateOrUpdateOrganizationTypeHelper
|
||||||
from registrar.utility.errors import FSMDomainRequestError, FSMErrorCodes
|
from registrar.utility.errors import FSMDomainRequestError, FSMErrorCodes
|
||||||
from registrar.utility.constants import BranchChoices
|
from registrar.utility.constants import BranchChoices
|
||||||
|
from auditlog.models import LogEntry
|
||||||
|
|
||||||
from .utility.time_stamped_model import TimeStampedModel
|
from .utility.time_stamped_model import TimeStampedModel
|
||||||
from ..utility.email import send_templated_email, EmailSendingError
|
from ..utility.email import send_templated_email, EmailSendingError
|
||||||
|
@ -589,11 +590,23 @@ class DomainRequest(TimeStampedModel):
|
||||||
verbose_name="last updated on",
|
verbose_name="last updated on",
|
||||||
help_text="Date of the last status update",
|
help_text="Date of the last status update",
|
||||||
)
|
)
|
||||||
|
|
||||||
notes = models.TextField(
|
notes = models.TextField(
|
||||||
null=True,
|
null=True,
|
||||||
blank=True,
|
blank=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_first_status_set_date(self, status):
|
||||||
|
"""Returns the date when the domain request was first set to the given status."""
|
||||||
|
log_entry = LogEntry.objects.filter(
|
||||||
|
content_type__model="domainrequest", object_pk=self.pk, changes__status__1=status
|
||||||
|
).order_by("-timestamp").first()
|
||||||
|
return log_entry.timestamp.date() if log_entry else None
|
||||||
|
|
||||||
|
def get_first_status_started_date(self):
|
||||||
|
"""Returns the date when the domain request was put into the status "started" for the first time"""
|
||||||
|
return self.get_first_status_set_date(DomainRequest.DomainRequestStatus.STARTED)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_statuses_that_send_emails(cls):
|
def get_statuses_that_send_emails(cls):
|
||||||
"""Returns a list of statuses that send an email to the user"""
|
"""Returns a list of statuses that send an email to the user"""
|
||||||
|
|
|
@ -34,8 +34,15 @@
|
||||||
Back to manage your domains
|
Back to manage your domains
|
||||||
</p>
|
</p>
|
||||||
</a>
|
</a>
|
||||||
{% comment %} {% endif %}{% endcomment %}
|
|
||||||
|
{% if DomainRequest.requested_domain %}
|
||||||
<h1>Domain request for {{ DomainRequest.requested_domain.name }}</h1>
|
<h1>Domain request for {{ DomainRequest.requested_domain.name }}</h1>
|
||||||
|
{% elif DomainRequest.status == DomainRequest.DomainRequestStatus.STARTED %}
|
||||||
|
<h1>New domain request</h1>
|
||||||
|
{% else %}
|
||||||
|
{% comment %} Question: What do we do in this case???? {% endcomment %}
|
||||||
|
<h1>Domain request for [UNKNOWN]</h1>
|
||||||
|
{% endif %}
|
||||||
<div
|
<div
|
||||||
class="usa-summary-box dotgov-status-box margin-top-3 padding-left-2"
|
class="usa-summary-box dotgov-status-box margin-top-3 padding-left-2"
|
||||||
role="region"
|
role="region"
|
||||||
|
@ -60,16 +67,23 @@
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% with statuses=DomainRequest.DomainRequestStatus last_submitted=DomainRequest.last_submitted_date|date:"F j, Y" first_submitted=DomainRequest.first_submitted_date|date:"F j, Y" %}
|
{% with statuses=DomainRequest.DomainRequestStatus last_submitted=DomainRequest.last_submitted_date|date:"F j, Y" first_submitted=DomainRequest.first_submitted_date|date:"F j, Y" last_status_update=DomainRequest.last_status_update|date:"F j, Y" %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
These are intentionally seperated this way.
|
These are intentionally seperated this way.
|
||||||
There is some code repetition, but it gives us more flexibility rather than a dense reduction.
|
There is some code repetition, but it gives us more flexibility rather than a dense reduction.
|
||||||
Leave it this way until we've solidified our requirements.
|
Leave it this way until we've solidified our requirements.
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
{% if DomainRequest.status == statuses.STARTED %}
|
{% if DomainRequest.status == statuses.STARTED %}
|
||||||
|
{% with first_started_date=DomainRequest.get_first_status_started_date|date:"F j, Y" %}
|
||||||
<p class="margin-top-1">
|
<p class="margin-top-1">
|
||||||
<b class="review__step__name">Started on:</b> {{DomainRequest.last_status_update|date:"F j, Y"}}
|
{% comment %}
|
||||||
|
A newly created domain request will not have a value for last_status update.
|
||||||
|
This is because the status never really updated.
|
||||||
|
However, if this somehow goes back to started we can default to displaying that new date.
|
||||||
|
{% endcomment %}
|
||||||
|
<b class="review__step__name">Started on:</b> {{last_status_update|default:first_started_date}}
|
||||||
</p>
|
</p>
|
||||||
|
{% endwith %}
|
||||||
{% elif DomainRequest.status == statuses.SUBMITTED %}
|
{% elif DomainRequest.status == statuses.SUBMITTED %}
|
||||||
<p class="margin-top-1 margin-bottom-1">
|
<p class="margin-top-1 margin-bottom-1">
|
||||||
<b class="review__step__name">Submitted on:</b> {{last_submitted|default:first_submitted }}
|
<b class="review__step__name">Submitted on:</b> {{last_submitted|default:first_submitted }}
|
||||||
|
@ -89,14 +103,14 @@
|
||||||
<b class="review__step__name">Submitted on:</b> {{last_submitted|default:first_submitted }}
|
<b class="review__step__name">Submitted on:</b> {{last_submitted|default:first_submitted }}
|
||||||
</p>
|
</p>
|
||||||
<p class="margin-top-1">
|
<p class="margin-top-1">
|
||||||
<b class="review__step__name">Rejected on:</b> {{DomainRequest.last_status_update|date:"F j, Y"}}
|
<b class="review__step__name">Rejected on:</b> {{last_status_update}}
|
||||||
</p>
|
</p>
|
||||||
{% elif DomainRequest.status == statuses.WITHDRAWN %}
|
{% elif DomainRequest.status == statuses.WITHDRAWN %}
|
||||||
<p class="margin-top-1 margin-bottom-1">
|
<p class="margin-top-1 margin-bottom-1">
|
||||||
<b class="review__step__name">Submitted on:</b> {{last_submitted|default:first_submitted }}
|
<b class="review__step__name">Submitted on:</b> {{last_submitted|default:first_submitted }}
|
||||||
</p>
|
</p>
|
||||||
<p class="margin-top-1">
|
<p class="margin-top-1">
|
||||||
<b class="review__step__name">Withdrawn on:</b> {{DomainRequest.last_status_update|date:"F j, Y"}}
|
<b class="review__step__name">Withdrawn on:</b> {{last_status_update}}
|
||||||
</p>
|
</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% comment %} Shown for in_review, approved, ineligible {% endcomment %}
|
{% comment %} Shown for in_review, approved, ineligible {% endcomment %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue