mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-04 17:01:56 +02:00
Merge branch 'main' into za/806-analyst-view-domain-management-data
This commit is contained in:
commit
8f2dd3f929
15 changed files with 129 additions and 19 deletions
|
@ -238,6 +238,9 @@ class Client(oic.Client):
|
|||
"client_secret": self.client_secret,
|
||||
},
|
||||
authn_method=self.registration_response["token_endpoint_auth_method"],
|
||||
# There is a time desync issue between login.gov and cloud
|
||||
# this addresses that by adding a clock skew.
|
||||
skew=10,
|
||||
)
|
||||
except Exception as err:
|
||||
logger.error(err)
|
||||
|
|
|
@ -54,6 +54,7 @@ services:
|
|||
# command: "python"
|
||||
command: >
|
||||
bash -c " python manage.py migrate &&
|
||||
python manage.py load &&
|
||||
python manage.py runserver 0.0.0.0:8080"
|
||||
|
||||
db:
|
||||
|
|
|
@ -91,6 +91,12 @@ class UserFixture:
|
|||
"first_name": "Alysia-Analyst",
|
||||
"last_name": "Alysia-Analyst",
|
||||
},
|
||||
{
|
||||
"username": "91a9b97c-bd0a-458d-9823-babfde7ebf44",
|
||||
"first_name": "Katherine-Analyst",
|
||||
"last_name": "Osos-Analyst",
|
||||
"email": "kosos@truss.works",
|
||||
},
|
||||
{
|
||||
"username": "2cc0cde8-8313-4a50-99d8-5882e71443e8",
|
||||
"first_name": "Zander-Analyst",
|
||||
|
@ -111,6 +117,12 @@ class UserFixture:
|
|||
"first_name": "David-Analyst",
|
||||
"last_name": "Kennedy-Analyst",
|
||||
},
|
||||
{
|
||||
"username": "0eb6f326-a3d4-410f-a521-aa4c1fad4e47",
|
||||
"first_name": "Gaby-Analyst",
|
||||
"last_name": "DiSarli-Analyst",
|
||||
"email": "gaby@truss.works",
|
||||
},
|
||||
]
|
||||
|
||||
STAFF_PERMISSIONS = [
|
||||
|
@ -258,6 +270,14 @@ class DomainApplicationFixture:
|
|||
"status": "withdrawn",
|
||||
"organization_name": "Example - Withdrawn",
|
||||
},
|
||||
{
|
||||
"status": "action needed",
|
||||
"organization_name": "Example - Action Needed",
|
||||
},
|
||||
{
|
||||
"status": "rejected",
|
||||
"organization_name": "Example - Rejected",
|
||||
},
|
||||
]
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -2,6 +2,7 @@ import logging
|
|||
|
||||
from django.core.management.base import BaseCommand
|
||||
from auditlog.context import disable_auditlog # type: ignore
|
||||
from django.conf import settings
|
||||
|
||||
from registrar.fixtures import UserFixture, DomainApplicationFixture, DomainFixture
|
||||
|
||||
|
@ -12,8 +13,11 @@ class Command(BaseCommand):
|
|||
def handle(self, *args, **options):
|
||||
# django-auditlog has some bugs with fixtures
|
||||
# https://github.com/jazzband/django-auditlog/issues/17
|
||||
with disable_auditlog():
|
||||
UserFixture.load()
|
||||
DomainApplicationFixture.load()
|
||||
DomainFixture.load()
|
||||
logger.info("All fixtures loaded.")
|
||||
if settings.DEBUG:
|
||||
with disable_auditlog():
|
||||
UserFixture.load()
|
||||
DomainApplicationFixture.load()
|
||||
DomainFixture.load()
|
||||
logger.info("All fixtures loaded.")
|
||||
else:
|
||||
logger.warn("Refusing to load fixture data in a non DEBUG env")
|
||||
|
|
|
@ -338,6 +338,9 @@ class Domain(TimeStampedModel, DomainHelper):
|
|||
help_text="Very basic info about the lifecycle of this domain object",
|
||||
)
|
||||
|
||||
def isActive(self):
|
||||
return self.state == Domain.State.CREATED
|
||||
|
||||
# ForeignKey on UserDomainRole creates a "permissions" member for
|
||||
# all of the user-roles that are in place for this domain
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import logging
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management import call_command
|
||||
from django.db.models.signals import post_save, post_migrate
|
||||
from django.db.models.signals import post_save
|
||||
from django.dispatch import receiver
|
||||
|
||||
from .models import User, Contact
|
||||
|
@ -55,13 +53,3 @@ def handle_profile(sender, instance, **kwargs):
|
|||
"There are multiple Contacts with the same email address."
|
||||
f" Picking #{contacts[0].id} for User #{instance.id}."
|
||||
)
|
||||
|
||||
|
||||
@receiver(post_migrate)
|
||||
def handle_loaddata(**kwargs):
|
||||
"""Attempt to load test fixtures when in DEBUG mode."""
|
||||
if settings.DEBUG:
|
||||
try:
|
||||
call_command("load")
|
||||
except Exception as e:
|
||||
logger.warning(e)
|
||||
|
|
12
src/registrar/templates/admin/change_form.html
Normal file
12
src/registrar/templates/admin/change_form.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
{% extends "admin/change_form.html" %}
|
||||
|
||||
{% comment %} Replace the Django ul markup with a div. We'll edit the child markup accordingly in change_form_object_tools {% endcomment %}
|
||||
{% block object-tools %}
|
||||
{% if change and not is_popup %}
|
||||
<div class="object-tools">
|
||||
{% block object-tools-items %}
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
20
src/registrar/templates/admin/change_form_object_tools.html
Normal file
20
src/registrar/templates/admin/change_form_object_tools.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
{% load i18n admin_urls %}
|
||||
|
||||
{% comment %} Replace li with p for more semantic HTML if we have a single child {% endcomment %}
|
||||
{% block object-tools-items %}
|
||||
{% url opts|admin_urlname:'history' original.pk|admin_urlquote as history_url %}
|
||||
{% if has_absolute_url %}
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{% add_preserved_filters history_url %}" class="historylink">{% translate "History" %}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ absolute_url }}" class="viewsitelink">{% translate "View on site" %}</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% else %}
|
||||
<p class="margin-0 padding-0">
|
||||
<a href="{% add_preserved_filters history_url %}" class="historylink">{% translate "History" %}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
|
@ -24,3 +24,12 @@
|
|||
{% endif %}
|
||||
</h2>
|
||||
{% endblock %}
|
||||
|
||||
{% comment %} Replace the Django ul markup with a div. We'll replace the li with a p in change_list_object_tools {% endcomment %}
|
||||
{% block object-tools %}
|
||||
<div class="object-tools">
|
||||
{% block object-tools-items %}
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
13
src/registrar/templates/admin/change_list_object_tools.html
Normal file
13
src/registrar/templates/admin/change_list_object_tools.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
{% load i18n admin_urls %}
|
||||
|
||||
{% comment %} Replace li with p for more semantic HTML {% endcomment %}
|
||||
{% block object-tools-items %}
|
||||
{% if has_add_permission %}
|
||||
<p class="margin-0 padding-0">
|
||||
{% url cl.opts|admin_urlname:'add' as add_url %}
|
||||
<a href="{% add_preserved_filters add_url is_popup to_field %}" class="addlink">
|
||||
{% blocktranslate with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktranslate %}
|
||||
</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
|
@ -17,7 +17,7 @@ Load our custom filters to extract info from the django generated markup.
|
|||
<thead>
|
||||
<tr>
|
||||
|
||||
{% if results.0.form %}
|
||||
{% if results.0|contains_checkbox %}
|
||||
{# .gov - hardcode the select all checkbox #}
|
||||
<th scope="col" class="action-checkbox-column" title="Toggle all">
|
||||
<div class="text">
|
||||
|
|
|
@ -84,6 +84,14 @@
|
|||
{% include "includes/summary_item.html" with title='Current website for your organization' value=domainapplication.current_websites.all list='true' heading_level=heading_level %}
|
||||
{% endif %}
|
||||
|
||||
{% if domainapplication.requested_domain %}
|
||||
{% include "includes/summary_item.html" with title='.gov domain' value=domainapplication.requested_domain heading_level=heading_level %}
|
||||
{% endif %}
|
||||
|
||||
{% if domainapplication.alternative_domains.all %}
|
||||
{% include "includes/summary_item.html" with title='Alternative domains' value=domainapplication.alternative_domains.all list='true' heading_level=heading_level %}
|
||||
{% endif %}
|
||||
|
||||
{% if domainapplication.purpose %}
|
||||
{% include "includes/summary_item.html" with title='Purpose of your domain' value=domainapplication.purpose heading_level=heading_level %}
|
||||
{% endif %}
|
||||
|
|
|
@ -40,3 +40,11 @@ def slice_after(value, substring):
|
|||
result = value[index + len(substring) :]
|
||||
return result
|
||||
return value
|
||||
|
||||
|
||||
@register.filter
|
||||
def contains_checkbox(html_list):
|
||||
for html_string in html_list:
|
||||
if re.search(r'<input[^>]*type="checkbox"', html_string):
|
||||
return True
|
||||
return False
|
||||
|
|
|
@ -8,6 +8,7 @@ from registrar.templatetags.custom_filters import (
|
|||
extract_a_text,
|
||||
find_index,
|
||||
slice_after,
|
||||
contains_checkbox,
|
||||
)
|
||||
|
||||
|
||||
|
@ -83,3 +84,21 @@ class CustomFiltersTestCase(TestCase):
|
|||
self.assertEqual(
|
||||
result, value
|
||||
) # Should return the original value if substring not found
|
||||
|
||||
def test_contains_checkbox_with_checkbox(self):
|
||||
# Test the filter when HTML list contains a checkbox
|
||||
html_list = [
|
||||
'<input type="checkbox" name="_selected_action">',
|
||||
"<div>Some other HTML content</div>",
|
||||
]
|
||||
result = contains_checkbox(html_list)
|
||||
self.assertTrue(result) # Expecting True
|
||||
|
||||
def test_contains_checkbox_without_checkbox(self):
|
||||
# Test the filter when HTML list does not contain a checkbox
|
||||
html_list = [
|
||||
"<div>Some HTML content without checkbox</div>",
|
||||
"<p>More HTML content</p>",
|
||||
]
|
||||
result = contains_checkbox(html_list)
|
||||
self.assertFalse(result) # Expecting False
|
||||
|
|
|
@ -1466,6 +1466,7 @@ class TestApplicationStatus(TestWithUser, WebTest):
|
|||
# click the "Manage" link
|
||||
detail_page = home_page.click("Manage")
|
||||
self.assertContains(detail_page, "city.gov")
|
||||
self.assertContains(detail_page, "city1.gov")
|
||||
self.assertContains(detail_page, "Chief Tester")
|
||||
self.assertContains(detail_page, "testy@town.com")
|
||||
self.assertContains(detail_page, "Admin Tester")
|
||||
|
@ -1504,6 +1505,7 @@ class TestApplicationStatus(TestWithUser, WebTest):
|
|||
# click the "Manage" link
|
||||
detail_page = home_page.click("Manage")
|
||||
self.assertContains(detail_page, "city.gov")
|
||||
self.assertContains(detail_page, "city1.gov")
|
||||
self.assertContains(detail_page, "Chief Tester")
|
||||
self.assertContains(detail_page, "testy@town.com")
|
||||
self.assertContains(detail_page, "Admin Tester")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue