mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-21 02:06:03 +02:00
Remove timer
This commit is contained in:
parent
b5784a1a88
commit
ca2e2168aa
5 changed files with 114 additions and 103 deletions
|
@ -2029,13 +2029,12 @@ class DomainAdmin(ListHeaderAdmin):
|
||||||
|
|
||||||
def change_view(self, request, object_id):
|
def change_view(self, request, object_id):
|
||||||
logger.info("Timing change_view on domain")
|
logger.info("Timing change_view on domain")
|
||||||
with Timer():
|
# If the analyst was recently editing a domain page,
|
||||||
# If the analyst was recently editing a domain page,
|
# delete any associated session values
|
||||||
# delete any associated session values
|
if "analyst_action" in request.session:
|
||||||
if "analyst_action" in request.session:
|
del request.session["analyst_action"]
|
||||||
del request.session["analyst_action"]
|
del request.session["analyst_action_location"]
|
||||||
del request.session["analyst_action_location"]
|
return super().change_view(request, object_id)
|
||||||
return super().change_view(request, object_id)
|
|
||||||
|
|
||||||
def has_change_permission(self, request, obj=None):
|
def has_change_permission(self, request, obj=None):
|
||||||
# Fixes a bug wherein users which are only is_staff
|
# Fixes a bug wherein users which are only is_staff
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 4.2.10 on 2024-05-06 20:21
|
# Generated by Django 4.2.10 on 2024-05-07 20:13
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import phonenumber_field.modelfields
|
import phonenumber_field.modelfields
|
||||||
|
@ -92,6 +92,10 @@ class Migration(migrations.Migration):
|
||||||
model_name="domain",
|
model_name="domain",
|
||||||
index=models.Index(fields=["name"], name="registrar_d_name_5b1956_idx"),
|
index=models.Index(fields=["name"], name="registrar_d_name_5b1956_idx"),
|
||||||
),
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name="domaininvitation",
|
||||||
|
index=models.Index(fields=["status"], name="registrar_d_status_e84571_idx"),
|
||||||
|
),
|
||||||
migrations.AddIndex(
|
migrations.AddIndex(
|
||||||
model_name="domainrequest",
|
model_name="domainrequest",
|
||||||
index=models.Index(fields=["requested_domain"], name="registrar_d_request_6894eb_idx"),
|
index=models.Index(fields=["requested_domain"], name="registrar_d_request_6894eb_idx"),
|
||||||
|
|
|
@ -15,6 +15,12 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class DomainInvitation(TimeStampedModel):
|
class DomainInvitation(TimeStampedModel):
|
||||||
|
class Meta:
|
||||||
|
"""Contains meta information about this class"""
|
||||||
|
indexes = [
|
||||||
|
models.Index(fields=["status"]),
|
||||||
|
]
|
||||||
|
|
||||||
# Constants for status field
|
# Constants for status field
|
||||||
class DomainInvitationStatus(models.TextChoices):
|
class DomainInvitationStatus(models.TextChoices):
|
||||||
INVITED = "invited", "Invited"
|
INVITED = "invited", "Invited"
|
||||||
|
|
|
@ -24,6 +24,13 @@ class User(AbstractUser):
|
||||||
but can be customized later.
|
but can be customized later.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
"""Contains meta information about this class"""
|
||||||
|
indexes = [
|
||||||
|
models.Index(fields=["username"]),
|
||||||
|
models.Index(fields=["email"]),
|
||||||
|
]
|
||||||
|
|
||||||
class VerificationTypeChoices(models.TextChoices):
|
class VerificationTypeChoices(models.TextChoices):
|
||||||
"""
|
"""
|
||||||
Users achieve access to our system in a few different ways.
|
Users achieve access to our system in a few different ways.
|
||||||
|
|
|
@ -380,111 +380,106 @@ def write_csv_for_requests(
|
||||||
def export_data_type_to_csv(csv_file):
|
def export_data_type_to_csv(csv_file):
|
||||||
"""All domains report with extra columns"""
|
"""All domains report with extra columns"""
|
||||||
logger.info("Timing export_data_type_to_csv")
|
logger.info("Timing export_data_type_to_csv")
|
||||||
with Timer():
|
writer = csv.writer(csv_file)
|
||||||
writer = csv.writer(csv_file)
|
# define columns to include in export
|
||||||
# define columns to include in export
|
columns = [
|
||||||
columns = [
|
"Domain name",
|
||||||
"Domain name",
|
"Status",
|
||||||
"Status",
|
"Expiration date",
|
||||||
"Expiration date",
|
"Domain type",
|
||||||
"Domain type",
|
"Agency",
|
||||||
"Agency",
|
"Organization name",
|
||||||
"Organization name",
|
"City",
|
||||||
"City",
|
"State",
|
||||||
"State",
|
"AO",
|
||||||
"AO",
|
"AO email",
|
||||||
"AO email",
|
"Security contact email",
|
||||||
"Security contact email",
|
# For domain manager we are pass it in as a parameter below in write_body
|
||||||
# For domain manager we are pass it in as a parameter below in write_body
|
]
|
||||||
]
|
|
||||||
|
|
||||||
# Coalesce is used to replace federal_type of None with ZZZZZ
|
# Coalesce is used to replace federal_type of None with ZZZZZ
|
||||||
sort_fields = [
|
sort_fields = [
|
||||||
"organization_type",
|
"organization_type",
|
||||||
Coalesce("federal_type", Value("ZZZZZ")),
|
Coalesce("federal_type", Value("ZZZZZ")),
|
||||||
"federal_agency",
|
"federal_agency",
|
||||||
"domain__name",
|
"domain__name",
|
||||||
]
|
]
|
||||||
filter_condition = {
|
filter_condition = {
|
||||||
"domain__state__in": [
|
"domain__state__in": [
|
||||||
Domain.State.READY,
|
Domain.State.READY,
|
||||||
Domain.State.DNS_NEEDED,
|
Domain.State.DNS_NEEDED,
|
||||||
Domain.State.ON_HOLD,
|
Domain.State.ON_HOLD,
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
write_csv_for_domains(
|
write_csv_for_domains(
|
||||||
writer, columns, sort_fields, filter_condition, should_get_domain_managers=True, should_write_header=True
|
writer, columns, sort_fields, filter_condition, should_get_domain_managers=True, should_write_header=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def export_data_full_to_csv(csv_file):
|
def export_data_full_to_csv(csv_file):
|
||||||
"""All domains report"""
|
"""All domains report"""
|
||||||
|
|
||||||
logger.info("Timing def export_data_full_to_csv")
|
writer = csv.writer(csv_file)
|
||||||
with Timer():
|
# define columns to include in export
|
||||||
writer = csv.writer(csv_file)
|
columns = [
|
||||||
# define columns to include in export
|
"Domain name",
|
||||||
columns = [
|
"Domain type",
|
||||||
"Domain name",
|
"Agency",
|
||||||
"Domain type",
|
"Organization name",
|
||||||
"Agency",
|
"City",
|
||||||
"Organization name",
|
"State",
|
||||||
"City",
|
"Security contact email",
|
||||||
"State",
|
]
|
||||||
"Security contact email",
|
# Coalesce is used to replace federal_type of None with ZZZZZ
|
||||||
]
|
sort_fields = [
|
||||||
# Coalesce is used to replace federal_type of None with ZZZZZ
|
"organization_type",
|
||||||
sort_fields = [
|
Coalesce("federal_type", Value("ZZZZZ")),
|
||||||
"organization_type",
|
"federal_agency",
|
||||||
Coalesce("federal_type", Value("ZZZZZ")),
|
"domain__name",
|
||||||
"federal_agency",
|
]
|
||||||
"domain__name",
|
filter_condition = {
|
||||||
]
|
"domain__state__in": [
|
||||||
filter_condition = {
|
Domain.State.READY,
|
||||||
"domain__state__in": [
|
Domain.State.DNS_NEEDED,
|
||||||
Domain.State.READY,
|
Domain.State.ON_HOLD,
|
||||||
Domain.State.DNS_NEEDED,
|
],
|
||||||
Domain.State.ON_HOLD,
|
}
|
||||||
],
|
write_csv_for_domains(
|
||||||
}
|
writer, columns, sort_fields, filter_condition, should_get_domain_managers=False, should_write_header=True
|
||||||
write_csv_for_domains(
|
)
|
||||||
writer, columns, sort_fields, filter_condition, should_get_domain_managers=False, should_write_header=True
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def export_data_federal_to_csv(csv_file):
|
def export_data_federal_to_csv(csv_file):
|
||||||
"""Federal domains report"""
|
"""Federal domains report"""
|
||||||
logger.info("Timing def export_data_federal_to_csv")
|
writer = csv.writer(csv_file)
|
||||||
with Timer():
|
# define columns to include in export
|
||||||
writer = csv.writer(csv_file)
|
columns = [
|
||||||
# define columns to include in export
|
"Domain name",
|
||||||
columns = [
|
"Domain type",
|
||||||
"Domain name",
|
"Agency",
|
||||||
"Domain type",
|
"Organization name",
|
||||||
"Agency",
|
"City",
|
||||||
"Organization name",
|
"State",
|
||||||
"City",
|
"Security contact email",
|
||||||
"State",
|
]
|
||||||
"Security contact email",
|
# Coalesce is used to replace federal_type of None with ZZZZZ
|
||||||
]
|
sort_fields = [
|
||||||
# Coalesce is used to replace federal_type of None with ZZZZZ
|
"organization_type",
|
||||||
sort_fields = [
|
Coalesce("federal_type", Value("ZZZZZ")),
|
||||||
"organization_type",
|
"federal_agency",
|
||||||
Coalesce("federal_type", Value("ZZZZZ")),
|
"domain__name",
|
||||||
"federal_agency",
|
]
|
||||||
"domain__name",
|
filter_condition = {
|
||||||
]
|
"organization_type__icontains": "federal",
|
||||||
filter_condition = {
|
"domain__state__in": [
|
||||||
"organization_type__icontains": "federal",
|
Domain.State.READY,
|
||||||
"domain__state__in": [
|
Domain.State.DNS_NEEDED,
|
||||||
Domain.State.READY,
|
Domain.State.ON_HOLD,
|
||||||
Domain.State.DNS_NEEDED,
|
],
|
||||||
Domain.State.ON_HOLD,
|
}
|
||||||
],
|
write_csv_for_domains(
|
||||||
}
|
writer, columns, sort_fields, filter_condition, should_get_domain_managers=False, should_write_header=True
|
||||||
write_csv_for_domains(
|
)
|
||||||
writer, columns, sort_fields, filter_condition, should_get_domain_managers=False, should_write_header=True
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def get_default_start_date():
|
def get_default_start_date():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue