internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: cisagov/manage.get.gov

Issue:
DomainApplication list on logged in user homepage
Outcome: A list (limited to one now) of domain applications on the homepage of a logged in user. 

A/C: As a user I want to see my in progress applications for a domain. As a user I want to be able to select an application that is `In Progress` and continue my progress. As a user I want to be able to view submitted applications. 


Discussion:

Resolving patch:
diff --git a/src/registrar/views/index.py b/src/registrar/views/index.py
--- a/src/registrar/views/index.py
+++ b/src/registrar/views/index.py
@@ -1,6 +1,12 @@
 from django.shortcuts import render
 
+from registrar.models import DomainApplication
+
 
 def index(request):
     """This page is available to anyone without logging in."""
-    return render(request, "home.html")
+    context = {}
+    if request.user.is_authenticated:
+        applications = DomainApplication.objects.filter(creator=request.user)
+        context["domain_applications"] = applications
+    return render(request, "home.html", context)


Test patch:
diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py
--- a/src/registrar/tests/test_views.py
+++ b/src/registrar/tests/test_views.py
@@ -5,7 +5,7 @@
 
 from django_webtest import WebTest  # type: ignore
 
-from registrar.models import DomainApplication
+from registrar.models import DomainApplication, Website
 
 
 class TestViews(TestCase):
@@ -54,6 +54,18 @@ def setUp(self):
         super().setUp()
         self.client.force_login(self.user)
 
+    def test_home_lists_domain_applications(self):
+        response = self.client.get("/")
+        self.assertNotContains(response, "igorville.gov")
+        site = Website.objects.create(website="igorville.gov")
+        application = DomainApplication.objects.create(
+            creator=self.user, requested_domain=site
+        )
+        response = self.client.get("/")
+        self.assertContains(response, "igorville.gov", count=1)
+        # clean up
+        application.delete()
+
     def test_whoami_page(self):
         """User information appears on the whoami page."""
         response = self.client.get("/whoami/")
Repository: cisagov/manage.get.gov

Issue:
Build Domain Submission Landing Page
**User Story**

As a user submitting a domain request I want to know my domain was successfully submitted so I can prepare for future steps

**Acceptance Criteria**

- Domain Request form has a landing page that aligns with wireframes

**Wireframe**

https://www.figma.com/proto/ninNjo0bTg7XfB4mvTp4hG/GetGov%2FWireframes?page-id=1057%3A4846&node-id=1077%3A7610&viewport=-1004%2C292%2C0.15&scaling=min-zoom&starting-point-node-id=1057%3A5291


Discussion:

Resolving patch:
diff --git a/src/registrar/forms/application_wizard.py b/src/registrar/forms/application_wizard.py
--- a/src/registrar/forms/application_wizard.py
+++ b/src/registrar/forms/application_wizard.py
@@ -3,7 +3,7 @@
 import logging
 
 from django import forms
-from django.shortcuts import redirect
+from django.shortcuts import render
 
 from django.contrib.auth.mixins import LoginRequiredMixin
 
@@ -357,4 +357,6 @@ def done(self, form_list, form_dict, **kwargs):
         application.submit()  # change the status to submitted
         application.save()
         logger.debug("Application object saved: %s", application.id)
-        return redirect("home")
+        return render(
+            self.request, "application_done.html", {"application_id": application.id}
+        )


Test patch:
diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py
--- a/src/registrar/tests/test_views.py
+++ b/src/registrar/tests/test_views.py
@@ -317,15 +317,8 @@ def test_application_form_submission(self):
         self.assertEquals(review_result.status_code, 302)
         self.assertEquals(review_result["Location"], "/register/finished/")
 
-        # the finished URL (for now) returns a redirect to /
         # following this redirect is a GET request, so include the cookie
         # here too.
-
         self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
-        root_page = review_result.follow()
-        self.assertEquals(root_page.status_code, 302)
-        self.assertEquals(root_page["Location"], "/")
-        self.assertContains(root_page.follow(), "Welcome to the .gov registrar")
-
-        # TODO: when we have a page that lists applications, visit it and
-        # make sure that the new one exists
+        final_result = review_result.follow()
+        self.assertContains(final_result, "Thank you for your domain request")
Repository: cisagov/manage.get.gov

Issue:
Implement new strategy for cloud.gov spaces for deployments
The engineering huddle has decided to make a new strategy for deployments. We are moving to having two types of spaces/deployments with tasks included: 
- Stable environment
  - This will rely on released tags and otherwise will not be deployed to
  - [x] New a documented process for cutting a release (something that a non-dev can do)
  - [x] Documentation for how the product manager conducts and on what cadence
  - [x] Remove staging/unstable environments
  - [x] Change Github actions to deploy on release
- Dev-specific environments
  - Automatically deployed on branch/PR per dev (`lmm`, `sj`, `nmb`, `ik` to start)
  - These will be used for QAing changes and will be automatically created for PR reviews
  - Up to dev to keep current/stable
  - Ad hoc deploys if dev wants to test anything
  - Everyone has their own DB
  - [x] Create these new environments
  - [x] Provision databases
  - [x] Create automation for deploying from pull requests/name-specific branches
  - [x] Documentation for automation and perhaps an ADR



Discussion:
We are going to do releases based on milestones

Resolving patch:
diff --git a/src/registrar/config/settings.py b/src/registrar/config/settings.py
--- a/src/registrar/config/settings.py
+++ b/src/registrar/config/settings.py
@@ -512,10 +512,14 @@
 # web server configurations.
 ALLOWED_HOSTS = [
     "getgov-stable.app.cloud.gov",
+    "getgov-mr.app.cloud.gov",
+    "getgov-sspj.app.cloud.gov",
+    "getgov-nmb.app.cloud.gov",
+    "getgov-ik.app.cloud.gov",
+    "getgov-lmm.app.cloud.gov",
     "get.gov",
 ]
 
-
 # Extend ALLOWED_HOSTS.
 # IP addresses can also be hosts, which are used by internal
 # load balancers for health checks, etc.


Test patch:
Repository: cisagov/manage.get.gov

Issue:
Don't display redundant form field labels
- Don't display redundant field labels 
- Retain field labels for screenreaders


Discussion:
Fields that show redundant labels:
- Organization website (remove "Public website")
- What .gov domain do you want
- Election office (remove "Is election board")
- Purpose
- Security email
- Federal government branch (remove "Federal type")




![Image](https://user-images.githubusercontent.com/60157596/218556825-e2376cd2-c4ba-4f86-8e78-571c819be123.png)



![Image](https://user-images.githubusercontent.com/60157596/218556931-bfa188b6-27fd-4e34-8d77-49456d1c83c6.png)



![Image](https://user-images.githubusercontent.com/60157596/218556976-ec65c241-24e7-43aa-947a-11789685cfd3.png)



![Image](https://user-images.githubusercontent.com/60157596/218557029-5472e54b-5b7e-4553-b36f-dc96659e6338.png)



![Image](https://user-images.githubusercontent.com/60157596/218557096-f83da89d-a57b-4e90-98b7-26532f2efafd.png)



![Image](https://user-images.githubusercontent.com/60157596/218557154-010356a6-e30c-4e88-909d-f8978354a1ed.png)



Resolving patch:
diff --git a/src/registrar/templatetags/field_helpers.py b/src/registrar/templatetags/field_helpers.py
--- a/src/registrar/templatetags/field_helpers.py
+++ b/src/registrar/templatetags/field_helpers.py
@@ -21,6 +21,7 @@ def input_with_errors(context, field=None):  # noqa: C901
         add_error_class: like `add_class` but only if field.errors is not empty
         add_required_class: like `add_class` but only if field is required
         add_label_class: append to input element's label's `class` attribute
+        add_legend_class: append to input element's legend's `class` attribute
         add_group_class: append to input element's surrounding tag's `class` attribute
         attr_* - adds or replaces any single html attribute for the input
         add_error_attr_* - like `attr_*` but only if field.errors is not empty
@@ -50,6 +51,7 @@ def input_with_errors(context, field=None):  # noqa: C901
     # these will be converted to CSS strings
     classes = []
     label_classes = []
+    legend_classes = []
     group_classes = []
 
     # this will be converted to an attribute string
@@ -82,6 +84,8 @@ def input_with_errors(context, field=None):  # noqa: C901
 
         elif key == "add_label_class":
             label_classes.append(value)
+        elif key == "add_legend_class":
+            legend_classes.append(value)
 
         elif key == "add_group_class":
             group_classes.append(value)
@@ -129,6 +133,9 @@ def input_with_errors(context, field=None):  # noqa: C901
     if label_classes:
         context["label_classes"] = " ".join(label_classes)
 
+    if legend_classes:
+        context["legend_classes"] = " ".join(legend_classes)
+
     if group_classes:
         context["group_classes"] = " ".join(group_classes)
 


Test patch:
Repository: cisagov/manage.get.gov

Issue:
Miscellaneous Design Tweaks to Registrar
- [ ] Style fine tuning on the form

- [ ] Fixing up some odd spacing and position


Discussion:

Resolving patch:
diff --git a/src/registrar/fixtures.py b/src/registrar/fixtures.py
--- a/src/registrar/fixtures.py
+++ b/src/registrar/fixtures.py
@@ -140,7 +140,13 @@ def _set_non_foreign_key_fields(cls, da: DomainApplication, app: dict):
         da.organization_type = (
             app["organization_type"] if "organization_type" in app else "federal"
         )
-        da.federal_agency = app["federal_agency"] if "federal_agency" in app else ""
+        da.federal_agency = (
+            app["federal_agency"]
+            if "federal_agency" in app
+            # Random choice of agency for selects, used as placeholders for testing.
+            else random.choice(DomainApplication.AGENCIES)  # nosec
+        )
+
         da.federal_type = (
             app["federal_type"]
             if "federal_type" in app


Test patch:
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -33,7 +33,7 @@ jobs:
         run: docker compose run app python manage.py test
 
   pa11y-scan:
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-20.04
     steps:
       - uses: actions/checkout@v3
 
diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py
--- a/src/registrar/tests/test_views.py
+++ b/src/registrar/tests/test_views.py
@@ -1090,7 +1090,7 @@ def test_domain_detail_link_works(self):
         home_page = self.app.get("/")
         self.assertContains(home_page, "igorville.gov")
         # click the "Edit" link
-        detail_page = home_page.click("Edit")
+        detail_page = home_page.click("Manage")
         self.assertContains(detail_page, "igorville.gov")
 
     def test_domain_user_management(self):
Repository: cisagov/manage.get.gov

Issue:
Document our data models
Per our last retrospective, we decided something that would help the growing complexity of our data modeling would be an updated diagram of the data model flows on the backend. 

Outcome: A diagram (preferably PlantUML?) saved to our docs folder under architecture. 

Here is an old version of this: https://raw.githubusercontent.com/cisagov/getgov/fcf9652e8f1c0e34b221dbfb4eb28767fcfab41e/docs/architecture/diagrams/models.svg

and a conversation around it: https://gsa-tts.slack.com/archives/C03QM0JGSQG/p1661970335955509


Discussion:

Resolving patch:
diff --git a/src/registrar/config/settings.py b/src/registrar/config/settings.py
--- a/src/registrar/config/settings.py
+++ b/src/registrar/config/settings.py
@@ -109,6 +109,8 @@
     "registrar",
     # Our internal API application
     "api",
+    # Only for generating documentation, uncomment to run manage.py generate_puml
+    # "puml_generator",
 ]
 
 # Middleware are routines for processing web requests.


Test patch:
Repository: cisagov/manage.get.gov

Issue:
Bug: School Districts Shouldn't be Asked if they Are Election Offices
**Current Experience**

- Currently, if a user selects "School District" as the organization type they are prompted to answer if they are an election office

**Expected Experience**

- If a user selects "School District" as the organization type they are prompted to answer if they are an election office, they should be sent to the Organization Name and Address Page (i.e., they should not be asked to provide any more organization type information)

Bug: School Districts Shouldn't be Asked if they Are Election Offices
**Current Experience**

- Currently, if a user selects "School District" as the organization type they are prompted to answer if they are an election office

**Expected Experience**

- If a user selects "School District" as the organization type they are prompted to answer if they are an election office, they should be sent to the Organization Name and Address Page (i.e., they should not be asked to provide any more organization type information)

Bug: School Districts Shouldn't be Asked if they Are Election Offices
**Current Experience**

- Currently, if a user selects "School District" as the organization type they are prompted to answer if they are an election office

**Expected Experience**

- If a user selects "School District" as the organization type they are prompted to answer if they are an election office, they should be sent to the Organization Name and Address Page (i.e., they should not be asked to provide any more organization type information)



Discussion:

Resolving patch:
diff --git a/src/registrar/models/domain_application.py b/src/registrar/models/domain_application.py
--- a/src/registrar/models/domain_application.py
+++ b/src/registrar/models/domain_application.py
@@ -562,11 +562,13 @@ def show_organization_election(self) -> bool:
         """Show this step if the answer to the first question implies it.
 
         This shows for answers that aren't "Federal" or "Interstate".
+        This also doesnt show if user selected "School District" as well (#524)
         """
         user_choice = self.organization_type
         excluded = [
             DomainApplication.OrganizationChoices.FEDERAL,
             DomainApplication.OrganizationChoices.INTERSTATE,
+            DomainApplication.OrganizationChoices.SCHOOL_DISTRICT,
         ]
         return bool(user_choice and user_choice not in excluded)
 


Test patch:
Repository: cisagov/manage.get.gov

Issue:
Bug: No error handling for too long values on Street address line 2 inputs
Entering a value over 15 characters will trigger an internal server error:

![Screen Shot 2023-05-11 at 12 42 24 PM](https://github.com/cisagov/getgov/assets/107004823/4fcdd1b9-20ed-4dd6-b3f5-c5d600c43b29)

![Screen Shot 2023-05-11 at 12 42 13 PM](https://github.com/cisagov/getgov/assets/107004823/8b10da5b-54e3-4ec4-adb7-04ae82250758)

![Screen Shot 2023-05-11 at 12 42 38 PM](https://github.com/cisagov/getgov/assets/107004823/989cf095-9fbf-40c2-a3c6-6e2b8a7959af)



Discussion:

Resolving patch:
diff --git a/src/registrar/migrations/0026_alter_domainapplication_address_line2_and_more.py b/src/registrar/migrations/0026_alter_domainapplication_address_line2_and_more.py
new file mode 100644
--- /dev/null
+++ b/src/registrar/migrations/0026_alter_domainapplication_address_line2_and_more.py
@@ -0,0 +1,26 @@
+# Generated by Django 4.2.1 on 2023-06-02 17:29
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+    dependencies = [
+        ("registrar", "0025_remove_domain_unique_domain_name_in_registry_and_more"),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name="domainapplication",
+            name="address_line2",
+            field=models.TextField(
+                blank=True, help_text="Street address line 2", null=True
+            ),
+        ),
+        migrations.AlterField(
+            model_name="domaininformation",
+            name="address_line2",
+            field=models.TextField(
+                blank=True, help_text="Street address line 2", null=True
+            ),
+        ),
+    ]
diff --git a/src/registrar/models/domain_application.py b/src/registrar/models/domain_application.py
--- a/src/registrar/models/domain_application.py
+++ b/src/registrar/models/domain_application.py
@@ -343,8 +343,7 @@ class BranchChoices(models.TextChoices):
         blank=True,
         help_text="Street address",
     )
-    address_line2 = models.CharField(
-        max_length=15,
+    address_line2 = models.TextField(
         null=True,
         blank=True,
         help_text="Street address line 2",
diff --git a/src/registrar/models/domain_information.py b/src/registrar/models/domain_information.py
--- a/src/registrar/models/domain_information.py
+++ b/src/registrar/models/domain_information.py
@@ -101,8 +101,7 @@ class DomainInformation(TimeStampedModel):
         blank=True,
         help_text="Street address",
     )
-    address_line2 = models.CharField(
-        max_length=15,
+    address_line2 = models.TextField(
         null=True,
         blank=True,
         help_text="Street address line 2",


Test patch:
Repository: cisagov/manage.get.gov

Issue:
Domain Application withdraw view should use a FSM transition method for withdrawing
### Ticket Description

When we implemented the action for withdrawing domain applications, we manipulated the application's `status` field directly https://github.com/cisagov/getgov/blob/main/src/registrar/views/application.py#L505. So that we can handle side-effects cleanly (for example sending a "Your application has been withdrawn" email message, we should change this code to use a new `withdraw()` method on the `DomainApplication` model.

There is an example in that same file for `approve()`. We would want applications to only be able to be withdrawn before they are approved.


### Issue Type

development

### Link dependent issues

_No response_


Discussion:

Resolving patch:
diff --git a/src/registrar/models/domain_application.py b/src/registrar/models/domain_application.py
--- a/src/registrar/models/domain_application.py
+++ b/src/registrar/models/domain_application.py
@@ -541,6 +541,10 @@ def approve(self):
             user=self.creator, domain=created_domain, role=UserDomainRole.Roles.ADMIN
         )
 
+    @transition(field="status", source=[SUBMITTED, INVESTIGATING], target=WITHDRAWN)
+    def withdraw(self):
+        """Withdraw an application that has been submitted."""
+
     # ## Form policies ###
     #
     # These methods control what questions need to be answered by applicants
diff --git a/src/registrar/views/application.py b/src/registrar/views/application.py
--- a/src/registrar/views/application.py
+++ b/src/registrar/views/application.py
@@ -502,6 +502,6 @@ def get(self, *args, **kwargs):
         to withdraw and send back to homepage.
         """
         application = DomainApplication.objects.get(id=self.kwargs["pk"])
-        application.status = "withdrawn"
+        application.withdraw()
         application.save()
         return HttpResponseRedirect(reverse("home"))


Test patch:
Repository: cisagov/manage.get.gov

Issue:
Create a Staging Environment in Cloud.gov
### User Story

Developers and Reviewers require a Staging environment in cloud.gov to support using stable as prod. 


### Acceptance Criteria

Update the environment creation script to produce and maintain a cloud.gov staging environment.

### Additional Context (optional)

_No response_

### Issue Links (optional)

_No response_


Discussion:
if a ticket is Status=Done 👍 then, it may be merged to main. Deployments to "staging" from main happen via the same/similar gitops process for stable deploy to "staging" using(tag "staging"-shorthash) of the recent commit to main.

"staging" should be considered volatile. That means testing may be occurring at points in time which may interrupt other testing. testing should be coordinated to avoid this issue.

Idea:
We could use tagging in git to "promote" tagged commits from "staging" to stable

Resolving patch:
diff --git a/src/registrar/config/settings.py b/src/registrar/config/settings.py
--- a/src/registrar/config/settings.py
+++ b/src/registrar/config/settings.py
@@ -564,6 +564,7 @@
 # web server configurations.
 ALLOWED_HOSTS = [
     "getgov-stable.app.cloud.gov",
+    "getgov-staging.app.cloud.gov",
     "getgov-gd.app.cloud.gov",
     "getgov-rb.app.cloud.gov",
     "getgov-ko.app.cloud.gov",


Test patch:
Repository: cisagov/manage.get.gov

Issue:
Add accessibility labels to django-admin checkboxes
### Issue Description

Issue Description
The current django admin checkboxes on list views do not have an accessible name and associated label and fail a 508 compliance check. 

AC
- checkboxes on django admin need to have an accessible name and an associated label.
- using a screen reader this accessible name should be readable.

### Additional Context (optional)

see the 508 compliance outcome in #788

### Issue Links

Issue Links
Relates to: #792
Relates to: #788
Relates to: #752


Discussion:

Resolving patch:
diff --git a/src/registrar/templatetags/custom_filters.py b/src/registrar/templatetags/custom_filters.py
new file mode 100644
--- /dev/null
+++ b/src/registrar/templatetags/custom_filters.py
@@ -0,0 +1,25 @@
+from django import template
+import re
+
+register = template.Library()
+
+
+@register.filter(name="extract_value")
+def extract_value(html_input):
+    match = re.search(r'value="([^"]*)"', html_input)
+    if match:
+        return match.group(1)
+    return ""
+
+
+@register.filter
+def extract_a_text(value):
+    # Use regex to extract the text within the <a> tag
+    pattern = r"<a\b[^>]*>(.*?)</a>"
+    match = re.search(pattern, value)
+    if match:
+        extracted_text = match.group(1)
+    else:
+        extracted_text = ""
+
+    return extracted_text


Test patch:
diff --git a/src/registrar/tests/test_templatetags.py b/src/registrar/tests/test_templatetags.py
--- a/src/registrar/tests/test_templatetags.py
+++ b/src/registrar/tests/test_templatetags.py
@@ -29,3 +29,33 @@ def test_public_site_url_leading_slash(self):
         self.assertTrue(result.startswith(settings.GETGOV_PUBLIC_SITE_URL))
         # slash-slash host slash directory slash page
         self.assertEqual(result.count("/"), 4)
+
+
+class CustomFiltersTestCase(TestCase):
+    def test_extract_value_filter(self):
+        from registrar.templatetags.custom_filters import extract_value
+
+        html_input = (
+            '<input type="checkbox" name="_selected_action" value="123" '
+            'id="label_123" class="action-select">'
+        )
+        result = extract_value(html_input)
+        self.assertEqual(result, "123")
+
+        html_input = (
+            '<input type="checkbox" name="_selected_action" value="abc" '
+            'id="label_123" class="action-select">'
+        )
+        result = extract_value(html_input)
+        self.assertEqual(result, "abc")
+
+    def test_extract_a_text_filter(self):
+        from registrar.templatetags.custom_filters import extract_a_text
+
+        input_text = '<a href="#">Link Text</a>'
+        result = extract_a_text(input_text)
+        self.assertEqual(result, "Link Text")
+
+        input_text = '<a href="/example">Another Link</a>'
+        result = extract_a_text(input_text)
+        self.assertEqual(result, "Another Link")