Linting and fix unit test

This commit is contained in:
zandercymatics 2024-01-16 08:52:03 -07:00
parent c949566744
commit a3f78e2ac7
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 11 additions and 16 deletions

View file

@ -26,12 +26,8 @@ class DraftDomain(TimeStampedModel, DomainHelper):
help_text="The draft number in the event a user doesn't save at this stage", help_text="The draft number in the event a user doesn't save at this stage",
) )
is_incomplete = models.BooleanField( is_incomplete = models.BooleanField(default=False, help_text="Determines if this Draft is complete or not")
default=False,
help_text="Determines if this Draft is complete or not"
)
def get_default_request_name(self): def get_default_request_name(self):
"""Returns the draft name that would be used for applications if no name exists""" """Returns the draft name that would be used for applications if no name exists"""
return f"New domain request {self.draft_number}" return f"New domain request {self.draft_number}"

View file

@ -1,6 +1,4 @@
import logging import logging
import re
from typing import List
from django.db.models import Q from django.db.models import Q
from django.http import Http404, HttpResponse, HttpResponseRedirect from django.http import Http404, HttpResponse, HttpResponseRedirect
@ -166,9 +164,11 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
name_field = "requested_domain__name" name_field = "requested_domain__name"
incomplete_drafts = existing_applications.exclude(requested_domain=None).filter( incomplete_drafts = (
requested_domain__name__icontains=default_draft_text existing_applications.exclude(requested_domain=None)
).order_by(name_field) .filter(requested_domain__name__icontains=default_draft_text)
.order_by(name_field)
)
incomplete_draft_names = incomplete_drafts.values_list(name_field, flat=True) incomplete_draft_names = incomplete_drafts.values_list(name_field, flat=True)
@ -403,7 +403,7 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
# Build the submit button that we'll pass to the modal. # Build the submit button that we'll pass to the modal.
modal_button = '<button type="submit" ' 'class="usa-button" ' ">Submit request</button>" modal_button = '<button type="submit" ' 'class="usa-button" ' ">Submit request</button>"
# Concatenate the modal header that we'll pass to the modal. # Concatenate the modal header that we'll pass to the modal.
if self.application.requested_domain: if self.application.requested_domain and not self.application.requested_domain.is_incomplete:
modal_heading = "You are about to submit a domain request for " + str(self.application.requested_domain) modal_heading = "You are about to submit a domain request for " + str(self.application.requested_domain)
else: else:
modal_heading = "You are about to submit an incomplete request" modal_heading = "You are about to submit an incomplete request"

View file

@ -1,7 +1,6 @@
from django.shortcuts import render from django.shortcuts import render
from registrar.models import DomainApplication, Domain, UserDomainRole from registrar.models import DomainApplication, Domain, UserDomainRole
from registrar.models.draft_domain import DraftDomain
def index(request): def index(request):