mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-15 00:57:02 +02:00
added user request details below creator in django admin
This commit is contained in:
parent
e4a8773e56
commit
cf946004c0
3 changed files with 34 additions and 0 deletions
|
@ -67,6 +67,24 @@ class User(AbstractUser):
|
|||
def is_restricted(self):
|
||||
return self.status == self.RESTRICTED
|
||||
|
||||
def get_approved_domains_count(self):
|
||||
"""Return count of approved domains"""
|
||||
allowed_states = ['unknown', 'dns needed', 'ready', 'on hold']
|
||||
approved_domains_count = self.domains.filter(state__in=allowed_states).count()
|
||||
return approved_domains_count
|
||||
|
||||
def get_active_requests_count(self):
|
||||
"""Return count of active requests"""
|
||||
allowed_states = ['submitted', 'in review', 'action needed']
|
||||
active_requests_count = self.domain_requests_created.filter(status__in=allowed_states).count()
|
||||
return active_requests_count
|
||||
|
||||
def get_rejected_requests_count(self):
|
||||
"""Return count of rejected or ineligible requests"""
|
||||
allowed_states = ['rejected', 'ineligible']
|
||||
rejected_requests_count = self.domain_requests_created.filter(status__in=allowed_states).count()
|
||||
return rejected_requests_count
|
||||
|
||||
@classmethod
|
||||
def needs_identity_verification(cls, email, uuid):
|
||||
"""A method used by our oidc classes to test whether a user needs email/uuid verification
|
||||
|
|
|
@ -65,6 +65,10 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html)
|
|||
<label aria-label="Creator contact details"></label>
|
||||
{% include "django/admin/includes/contact_detail_list.html" with user=original.creator no_title_top_padding=field.is_readonly %}
|
||||
</div>
|
||||
<div class="flex-container">
|
||||
<label aria-label="User summary details"></label>
|
||||
{% include "django/admin/includes/user_detail_list.html" with user=original.creator no_title_top_padding=field.is_readonly %}
|
||||
</div>
|
||||
{% elif field.field.name == "submitter" %}
|
||||
<div class="flex-container">
|
||||
<label aria-label="Submitter contact details"></label>
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{% load i18n static %}
|
||||
|
||||
<address class="{% if no_title_top_padding %}margin-top-neg-1__detail-list{% endif %} dja-address-contact-list">
|
||||
|
||||
{# Approved domains #}
|
||||
Approved domains: {{ user.get_approved_domains_count }}<br>
|
||||
{# Active requests #}
|
||||
Active requests: {{ user.get_active_requests_count }}<br>
|
||||
{# Rejected or ineligible requests #}
|
||||
Rejected or ineligible: {{ user.get_rejected_requests_count }}<br>
|
||||
|
||||
</address>
|
Loading…
Add table
Add a link
Reference in a new issue