We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Submission dates for fixture domain requests are blank
### Current Behavior

For applications generated by fixtures, submission dates are not showing because they are not set to begin with

![image](https://github.com/cisagov/manage.get.gov/assets/144387994/46ca040a-3b72-4ff4-be4b-5094eb604bcd)


### Expected Behavior

Submission dates are shown

### Steps to Reproduce

1. Logon as Domain Manager with an account associated with fixtures
2. View Domain request table
3. Date submitted column is blank (for any requests from fixtures)


### Environment

Development sandbox

### Additional Context

Per Alysia, submission date should be added to fixtures for the fake data

### Issue Links

_No response_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/registrar/fixtures_applications.py`
Content:
```
1 import logging
2 import random
3 from faker import Faker
4 
5 from registrar.models import (
6     User,
7     DomainApplication,
8     DraftDomain,
9     Contact,
10     Website,
11 )
12 
13 fake = Faker()
14 logger = logging.getLogger(__name__)
15 
16 
17 class DomainApplicationFixture:
18     """
19     Load domain applications into the database.
20 
21     Make sure this class' `load` method is called from `handle`
22     in management/commands/load.py, then use `./manage.py load`
23     to run this code.
24     """
25 
26     # any fields not specified here will be filled in with fake data or defaults
27     # NOTE BENE: each fixture must have `organization_name` for uniqueness!
28     # Here is a more complete example as a template:
29     # {
30     #     "status": "started",
31     #     "organization_name": "Example - Just started",
32     #     "organization_type": "federal",
33     #     "federal_agency": None,
34     #     "federal_type": None,
35     #     "address_line1": None,
36     #     "address_line2": None,
37     #     "city": None,
38     #     "state_territory": None,
39     #     "zipcode": None,
40     #     "urbanization": None,
41     #     "purpose": None,
42     #     "anything_else": None,
43     #     "is_policy_acknowledged": None,
44     #     "authorizing_official": None,
45     #     "submitter": None,
46     #     "other_contacts": [],
47     #     "current_websites": [],
48     #     "alternative_domains": [],
49     # },
50     DA = [
51         {
52             "status": DomainApplication.ApplicationStatus.STARTED,
53             "organization_name": "Example - Finished but not submitted",
54         },
55         {
56             "status": DomainApplication.ApplicationStatus.SUBMITTED,
57             "organization_name": "Example - Submitted but pending investigation",
58         },
59         {
60             "status": DomainApplication.ApplicationStatus.IN_REVIEW,
61             "organization_name": "Example - In investigation",
62         },
63         {
64             "status": DomainApplication.ApplicationStatus.IN_REVIEW,
65             "organization_name": "Example - Approved",
66         },
67         {
68             "status": DomainApplication.ApplicationStatus.WITHDRAWN,
69             "organization_name": "Example - Withdrawn",
70         },
71         {
72             "status": DomainApplication.ApplicationStatus.ACTION_NEEDED,
73             "organization_name": "Example - Action needed",
74         },
75         {
76             "status": "rejected",
77             "organization_name": "Example - Rejected",
78         },
79     ]
80 
81     @classmethod
82     def fake_contact(cls):
83         return {
84             "first_name": fake.first_name(),
85             "middle_name": None,
86             "last_name": fake.last_name(),
87             "title": fake.job(),
88             "email": fake.ascii_safe_email(),
89             "phone": "201-555-5555",
90         }
91 
92     @classmethod
93     def fake_dot_gov(cls):
94         return f"{fake.slug()}.gov"
95 
96     @classmethod
97     def _set_non_foreign_key_fields(cls, da: DomainApplication, app: dict):
98         """Helper method used by `load`."""
99         da.status = app["status"] if "status" in app else "started"
100         da.organization_type = app["organization_type"] if "organization_type" in app else "federal"
101         da.federal_agency = (
102             app["federal_agency"]
103             if "federal_agency" in app
104             # Random choice of agency for selects, used as placeholders for testing.
105             else random.choice(DomainApplication.AGENCIES)  # nosec
106         )
107 
108         da.federal_type = (
109             app["federal_type"]
110             if "federal_type" in app
111             else random.choice(["executive", "judicial", "legislative"])  # nosec
112         )
113         da.address_line1 = app["address_line1"] if "address_line1" in app else fake.street_address()
114         da.address_line2 = app["address_line2"] if "address_line2" in app else None
115         da.city = app["city"] if "city" in app else fake.city()
116         da.state_territory = app["state_territory"] if "state_territory" in app else fake.state_abbr()
117         da.zipcode = app["zipcode"] if "zipcode" in app else fake.postalcode()
118         da.urbanization = app["urbanization"] if "urbanization" in app else None
119         da.purpose = app["purpose"] if "purpose" in app else fake.paragraph()
120         da.anything_else = app["anything_else"] if "anything_else" in app else None
121         da.is_policy_acknowledged = app["is_policy_acknowledged"] if "is_policy_acknowledged" in app else True
122 
123     @classmethod
124     def _set_foreign_key_fields(cls, da: DomainApplication, app: dict, user: User):
125         """Helper method used by `load`."""
126         if not da.investigator:
127             da.investigator = User.objects.get(username=user.username) if "investigator" in app else None
128 
129         if not da.authorizing_official:
130             if "authorizing_official" in app and app["authorizing_official"] is not None:
131                 da.authorizing_official, _ = Contact.objects.get_or_create(**app["authorizing_official"])
132             else:
133                 da.authorizing_official = Contact.objects.create(**cls.fake_contact())
134 
135         if not da.submitter:
136             if "submitter" in app and app["submitter"] is not None:
137                 da.submitter, _ = Contact.objects.get_or_create(**app["submitter"])
138             else:
139                 da.submitter = Contact.objects.create(**cls.fake_contact())
140 
141         if not da.requested_domain:
142             if "requested_domain" in app and app["requested_domain"] is not None:
143                 da.requested_domain, _ = DraftDomain.objects.get_or_create(name=app["requested_domain"])
144             else:
145                 da.requested_domain = DraftDomain.objects.create(name=cls.fake_dot_gov())
146 
147     @classmethod
148     def _set_many_to_many_relations(cls, da: DomainApplication, app: dict):
149         """Helper method used by `load`."""
150         if "other_contacts" in app:
151             for contact in app["other_contacts"]:
152                 da.other_contacts.add(Contact.objects.get_or_create(**contact)[0])
153         elif not da.other_contacts.exists():
154             other_contacts = [
155                 Contact.objects.create(**cls.fake_contact()) for _ in range(random.randint(0, 3))  # nosec
156             ]
157             da.other_contacts.add(*other_contacts)
158 
159         if "current_websites" in app:
160             for website in app["current_websites"]:
161                 da.current_websites.add(Website.objects.get_or_create(website=website)[0])
162         elif not da.current_websites.exists():
163             current_websites = [
164                 Website.objects.create(website=fake.uri()) for _ in range(random.randint(0, 3))  # nosec
165             ]
166             da.current_websites.add(*current_websites)
167 
168         if "alternative_domains" in app:
169             for domain in app["alternative_domains"]:
170                 da.alternative_domains.add(Website.objects.get_or_create(website=domain)[0])
171         elif not da.alternative_domains.exists():
172             alternative_domains = [
173                 Website.objects.create(website=cls.fake_dot_gov()) for _ in range(random.randint(0, 3))  # nosec
174             ]
175             da.alternative_domains.add(*alternative_domains)
176 
177     @classmethod
178     def load(cls):
179         """Creates domain applications for each user in the database."""
180         logger.info("Going to load %s domain applications" % len(cls.DA))
181         try:
182             users = list(User.objects.all())  # force evaluation to catch db errors
183         except Exception as e:
184             logger.warning(e)
185             return
186 
187         for user in users:
188             logger.debug("Loading domain applications for %s" % user)
189             for app in cls.DA:
190                 try:
191                     da, _ = DomainApplication.objects.get_or_create(
192                         creator=user,
193                         organization_name=app["organization_name"],
194                     )
195                     cls._set_non_foreign_key_fields(da, app)
196                     cls._set_foreign_key_fields(da, app, user)
197                     da.save()
198                     cls._set_many_to_many_relations(da, app)
199                 except Exception as e:
200                     logger.warning(e)
201 
202 
203 class DomainFixture(DomainApplicationFixture):
204 
205     """Create one domain and permissions on it for each user."""
206 
207     @classmethod
208     def load(cls):
209         try:
210             users = list(User.objects.all())  # force evaluation to catch db errors
211         except Exception as e:
212             logger.warning(e)
213             return
214 
215         for user in users:
216             # approve one of each users in review status domains
217             application = DomainApplication.objects.filter(
218                 creator=user, status=DomainApplication.ApplicationStatus.IN_REVIEW
219             ).last()
220             logger.debug(f"Approving {application} for {user}")
221 
222             # We don't want fixtures sending out real emails to
223             # fake email addresses, so we just skip that and log it instead
224             application.approve(send_email=False)
225             application.save()
226
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/registrar/fixtures_applications.py b/src/registrar/fixtures_applications.py
--- a/src/registrar/fixtures_applications.py
+++ b/src/registrar/fixtures_applications.py
@@ -104,7 +104,7 @@
             # Random choice of agency for selects, used as placeholders for testing.
             else random.choice(DomainApplication.AGENCIES)  # nosec
         )
-
+        da.submission_date = fake.date()
         da.federal_type = (
             app["federal_type"]
             if "federal_type" in app

{"golden_diff": "diff --git a/src/registrar/fixtures_applications.py b/src/registrar/fixtures_applications.py\n--- a/src/registrar/fixtures_applications.py\n+++ b/src/registrar/fixtures_applications.py\n@@ -104,7 +104,7 @@\n             # Random choice of agency for selects, used as placeholders for testing.\n             else random.choice(DomainApplication.AGENCIES)  # nosec\n         )\n-\n+        da.submission_date = fake.date()\n         da.federal_type = (\n             app[\"federal_type\"]\n             if \"federal_type\" in app\n", "issue": "Submission dates for fixture domain requests are blank\n### Current Behavior\r\n\r\nFor applications generated by fixtures, submission dates are not showing because they are not set to begin with\r\n\r\n![image](https://github.com/cisagov/manage.get.gov/assets/144387994/46ca040a-3b72-4ff4-be4b-5094eb604bcd)\r\n\r\n\r\n### Expected Behavior\r\n\r\nSubmission dates are shown\r\n\r\n### Steps to Reproduce\r\n\r\n1. Logon as Domain Manager with an account associated with fixtures\r\n2. View Domain request table\r\n3. Date submitted column is blank (for any requests from fixtures)\r\n\r\n\r\n### Environment\r\n\r\nDevelopment sandbox\r\n\r\n### Additional Context\r\n\r\nPer Alysia, submission date should be added to fixtures for the fake data\r\n\r\n### Issue Links\r\n\r\n_No response_\n", "before_files": [{"content": "import logging\nimport random\nfrom faker import Faker\n\nfrom registrar.models import (\n    User,\n    DomainApplication,\n    DraftDomain,\n    Contact,\n    Website,\n)\n\nfake = Faker()\nlogger = logging.getLogger(__name__)\n\n\nclass DomainApplicationFixture:\n    \"\"\"\n    Load domain applications into the database.\n\n    Make sure this class' `load` method is called from `handle`\n    in management/commands/load.py, then use `./manage.py load`\n    to run this code.\n    \"\"\"\n\n    # any fields not specified here will be filled in with fake data or defaults\n    # NOTE BENE: each fixture must have `organization_name` for uniqueness!\n    # Here is a more complete example as a template:\n    # {\n    #     \"status\": \"started\",\n    #     \"organization_name\": \"Example - Just started\",\n    #     \"organization_type\": \"federal\",\n    #     \"federal_agency\": None,\n    #     \"federal_type\": None,\n    #     \"address_line1\": None,\n    #     \"address_line2\": None,\n    #     \"city\": None,\n    #     \"state_territory\": None,\n    #     \"zipcode\": None,\n    #     \"urbanization\": None,\n    #     \"purpose\": None,\n    #     \"anything_else\": None,\n    #     \"is_policy_acknowledged\": None,\n    #     \"authorizing_official\": None,\n    #     \"submitter\": None,\n    #     \"other_contacts\": [],\n    #     \"current_websites\": [],\n    #     \"alternative_domains\": [],\n    # },\n    DA = [\n        {\n            \"status\": DomainApplication.ApplicationStatus.STARTED,\n            \"organization_name\": \"Example - Finished but not submitted\",\n        },\n        {\n            \"status\": DomainApplication.ApplicationStatus.SUBMITTED,\n            \"organization_name\": \"Example - Submitted but pending investigation\",\n        },\n        {\n            \"status\": DomainApplication.ApplicationStatus.IN_REVIEW,\n            \"organization_name\": \"Example - In investigation\",\n        },\n        {\n            \"status\": DomainApplication.ApplicationStatus.IN_REVIEW,\n            \"organization_name\": \"Example - Approved\",\n        },\n        {\n            \"status\": DomainApplication.ApplicationStatus.WITHDRAWN,\n            \"organization_name\": \"Example - Withdrawn\",\n        },\n        {\n            \"status\": DomainApplication.ApplicationStatus.ACTION_NEEDED,\n            \"organization_name\": \"Example - Action needed\",\n        },\n        {\n            \"status\": \"rejected\",\n            \"organization_name\": \"Example - Rejected\",\n        },\n    ]\n\n    @classmethod\n    def fake_contact(cls):\n        return {\n            \"first_name\": fake.first_name(),\n            \"middle_name\": None,\n            \"last_name\": fake.last_name(),\n            \"title\": fake.job(),\n            \"email\": fake.ascii_safe_email(),\n            \"phone\": \"201-555-5555\",\n        }\n\n    @classmethod\n    def fake_dot_gov(cls):\n        return f\"{fake.slug()}.gov\"\n\n    @classmethod\n    def _set_non_foreign_key_fields(cls, da: DomainApplication, app: dict):\n        \"\"\"Helper method used by `load`.\"\"\"\n        da.status = app[\"status\"] if \"status\" in app else \"started\"\n        da.organization_type = app[\"organization_type\"] if \"organization_type\" in app else \"federal\"\n        da.federal_agency = (\n            app[\"federal_agency\"]\n            if \"federal_agency\" in app\n            # Random choice of agency for selects, used as placeholders for testing.\n            else random.choice(DomainApplication.AGENCIES)  # nosec\n        )\n\n        da.federal_type = (\n            app[\"federal_type\"]\n            if \"federal_type\" in app\n            else random.choice([\"executive\", \"judicial\", \"legislative\"])  # nosec\n        )\n        da.address_line1 = app[\"address_line1\"] if \"address_line1\" in app else fake.street_address()\n        da.address_line2 = app[\"address_line2\"] if \"address_line2\" in app else None\n        da.city = app[\"city\"] if \"city\" in app else fake.city()\n        da.state_territory = app[\"state_territory\"] if \"state_territory\" in app else fake.state_abbr()\n        da.zipcode = app[\"zipcode\"] if \"zipcode\" in app else fake.postalcode()\n        da.urbanization = app[\"urbanization\"] if \"urbanization\" in app else None\n        da.purpose = app[\"purpose\"] if \"purpose\" in app else fake.paragraph()\n        da.anything_else = app[\"anything_else\"] if \"anything_else\" in app else None\n        da.is_policy_acknowledged = app[\"is_policy_acknowledged\"] if \"is_policy_acknowledged\" in app else True\n\n    @classmethod\n    def _set_foreign_key_fields(cls, da: DomainApplication, app: dict, user: User):\n        \"\"\"Helper method used by `load`.\"\"\"\n        if not da.investigator:\n            da.investigator = User.objects.get(username=user.username) if \"investigator\" in app else None\n\n        if not da.authorizing_official:\n            if \"authorizing_official\" in app and app[\"authorizing_official\"] is not None:\n                da.authorizing_official, _ = Contact.objects.get_or_create(**app[\"authorizing_official\"])\n            else:\n                da.authorizing_official = Contact.objects.create(**cls.fake_contact())\n\n        if not da.submitter:\n            if \"submitter\" in app and app[\"submitter\"] is not None:\n                da.submitter, _ = Contact.objects.get_or_create(**app[\"submitter\"])\n            else:\n                da.submitter = Contact.objects.create(**cls.fake_contact())\n\n        if not da.requested_domain:\n            if \"requested_domain\" in app and app[\"requested_domain\"] is not None:\n                da.requested_domain, _ = DraftDomain.objects.get_or_create(name=app[\"requested_domain\"])\n            else:\n                da.requested_domain = DraftDomain.objects.create(name=cls.fake_dot_gov())\n\n    @classmethod\n    def _set_many_to_many_relations(cls, da: DomainApplication, app: dict):\n        \"\"\"Helper method used by `load`.\"\"\"\n        if \"other_contacts\" in app:\n            for contact in app[\"other_contacts\"]:\n                da.other_contacts.add(Contact.objects.get_or_create(**contact)[0])\n        elif not da.other_contacts.exists():\n            other_contacts = [\n                Contact.objects.create(**cls.fake_contact()) for _ in range(random.randint(0, 3))  # nosec\n            ]\n            da.other_contacts.add(*other_contacts)\n\n        if \"current_websites\" in app:\n            for website in app[\"current_websites\"]:\n                da.current_websites.add(Website.objects.get_or_create(website=website)[0])\n        elif not da.current_websites.exists():\n            current_websites = [\n                Website.objects.create(website=fake.uri()) for _ in range(random.randint(0, 3))  # nosec\n            ]\n            da.current_websites.add(*current_websites)\n\n        if \"alternative_domains\" in app:\n            for domain in app[\"alternative_domains\"]:\n                da.alternative_domains.add(Website.objects.get_or_create(website=domain)[0])\n        elif not da.alternative_domains.exists():\n            alternative_domains = [\n                Website.objects.create(website=cls.fake_dot_gov()) for _ in range(random.randint(0, 3))  # nosec\n            ]\n            da.alternative_domains.add(*alternative_domains)\n\n    @classmethod\n    def load(cls):\n        \"\"\"Creates domain applications for each user in the database.\"\"\"\n        logger.info(\"Going to load %s domain applications\" % len(cls.DA))\n        try:\n            users = list(User.objects.all())  # force evaluation to catch db errors\n        except Exception as e:\n            logger.warning(e)\n            return\n\n        for user in users:\n            logger.debug(\"Loading domain applications for %s\" % user)\n            for app in cls.DA:\n                try:\n                    da, _ = DomainApplication.objects.get_or_create(\n                        creator=user,\n                        organization_name=app[\"organization_name\"],\n                    )\n                    cls._set_non_foreign_key_fields(da, app)\n                    cls._set_foreign_key_fields(da, app, user)\n                    da.save()\n                    cls._set_many_to_many_relations(da, app)\n                except Exception as e:\n                    logger.warning(e)\n\n\nclass DomainFixture(DomainApplicationFixture):\n\n    \"\"\"Create one domain and permissions on it for each user.\"\"\"\n\n    @classmethod\n    def load(cls):\n        try:\n            users = list(User.objects.all())  # force evaluation to catch db errors\n        except Exception as e:\n            logger.warning(e)\n            return\n\n        for user in users:\n            # approve one of each users in review status domains\n            application = DomainApplication.objects.filter(\n                creator=user, status=DomainApplication.ApplicationStatus.IN_REVIEW\n            ).last()\n            logger.debug(f\"Approving {application} for {user}\")\n\n            # We don't want fixtures sending out real emails to\n            # fake email addresses, so we just skip that and log it instead\n            application.approve(send_email=False)\n            application.save()\n", "path": "src/registrar/fixtures_applications.py"}], "after_files": [{"content": "import logging\nimport random\nfrom faker import Faker\n\nfrom registrar.models import (\n    User,\n    DomainApplication,\n    DraftDomain,\n    Contact,\n    Website,\n)\n\nfake = Faker()\nlogger = logging.getLogger(__name__)\n\n\nclass DomainApplicationFixture:\n    \"\"\"\n    Load domain applications into the database.\n\n    Make sure this class' `load` method is called from `handle`\n    in management/commands/load.py, then use `./manage.py load`\n    to run this code.\n    \"\"\"\n\n    # any fields not specified here will be filled in with fake data or defaults\n    # NOTE BENE: each fixture must have `organization_name` for uniqueness!\n    # Here is a more complete example as a template:\n    # {\n    #     \"status\": \"started\",\n    #     \"organization_name\": \"Example - Just started\",\n    #     \"organization_type\": \"federal\",\n    #     \"federal_agency\": None,\n    #     \"federal_type\": None,\n    #     \"address_line1\": None,\n    #     \"address_line2\": None,\n    #     \"city\": None,\n    #     \"state_territory\": None,\n    #     \"zipcode\": None,\n    #     \"urbanization\": None,\n    #     \"purpose\": None,\n    #     \"anything_else\": None,\n    #     \"is_policy_acknowledged\": None,\n    #     \"authorizing_official\": None,\n    #     \"submitter\": None,\n    #     \"other_contacts\": [],\n    #     \"current_websites\": [],\n    #     \"alternative_domains\": [],\n    # },\n    DA = [\n        {\n            \"status\": DomainApplication.ApplicationStatus.STARTED,\n            \"organization_name\": \"Example - Finished but not submitted\",\n        },\n        {\n            \"status\": DomainApplication.ApplicationStatus.SUBMITTED,\n            \"organization_name\": \"Example - Submitted but pending investigation\",\n        },\n        {\n            \"status\": DomainApplication.ApplicationStatus.IN_REVIEW,\n            \"organization_name\": \"Example - In investigation\",\n        },\n        {\n            \"status\": DomainApplication.ApplicationStatus.IN_REVIEW,\n            \"organization_name\": \"Example - Approved\",\n        },\n        {\n            \"status\": DomainApplication.ApplicationStatus.WITHDRAWN,\n            \"organization_name\": \"Example - Withdrawn\",\n        },\n        {\n            \"status\": DomainApplication.ApplicationStatus.ACTION_NEEDED,\n            \"organization_name\": \"Example - Action needed\",\n        },\n        {\n            \"status\": \"rejected\",\n            \"organization_name\": \"Example - Rejected\",\n        },\n    ]\n\n    @classmethod\n    def fake_contact(cls):\n        return {\n            \"first_name\": fake.first_name(),\n            \"middle_name\": None,\n            \"last_name\": fake.last_name(),\n            \"title\": fake.job(),\n            \"email\": fake.ascii_safe_email(),\n            \"phone\": \"201-555-5555\",\n        }\n\n    @classmethod\n    def fake_dot_gov(cls):\n        return f\"{fake.slug()}.gov\"\n\n    @classmethod\n    def _set_non_foreign_key_fields(cls, da: DomainApplication, app: dict):\n        \"\"\"Helper method used by `load`.\"\"\"\n        da.status = app[\"status\"] if \"status\" in app else \"started\"\n        da.organization_type = app[\"organization_type\"] if \"organization_type\" in app else \"federal\"\n        da.federal_agency = (\n            app[\"federal_agency\"]\n            if \"federal_agency\" in app\n            # Random choice of agency for selects, used as placeholders for testing.\n            else random.choice(DomainApplication.AGENCIES)  # nosec\n        )\n        da.submission_date = fake.date()\n        da.federal_type = (\n            app[\"federal_type\"]\n            if \"federal_type\" in app\n            else random.choice([\"executive\", \"judicial\", \"legislative\"])  # nosec\n        )\n        da.address_line1 = app[\"address_line1\"] if \"address_line1\" in app else fake.street_address()\n        da.address_line2 = app[\"address_line2\"] if \"address_line2\" in app else None\n        da.city = app[\"city\"] if \"city\" in app else fake.city()\n        da.state_territory = app[\"state_territory\"] if \"state_territory\" in app else fake.state_abbr()\n        da.zipcode = app[\"zipcode\"] if \"zipcode\" in app else fake.postalcode()\n        da.urbanization = app[\"urbanization\"] if \"urbanization\" in app else None\n        da.purpose = app[\"purpose\"] if \"purpose\" in app else fake.paragraph()\n        da.anything_else = app[\"anything_else\"] if \"anything_else\" in app else None\n        da.is_policy_acknowledged = app[\"is_policy_acknowledged\"] if \"is_policy_acknowledged\" in app else True\n\n    @classmethod\n    def _set_foreign_key_fields(cls, da: DomainApplication, app: dict, user: User):\n        \"\"\"Helper method used by `load`.\"\"\"\n        if not da.investigator:\n            da.investigator = User.objects.get(username=user.username) if \"investigator\" in app else None\n\n        if not da.authorizing_official:\n            if \"authorizing_official\" in app and app[\"authorizing_official\"] is not None:\n                da.authorizing_official, _ = Contact.objects.get_or_create(**app[\"authorizing_official\"])\n            else:\n                da.authorizing_official = Contact.objects.create(**cls.fake_contact())\n\n        if not da.submitter:\n            if \"submitter\" in app and app[\"submitter\"] is not None:\n                da.submitter, _ = Contact.objects.get_or_create(**app[\"submitter\"])\n            else:\n                da.submitter = Contact.objects.create(**cls.fake_contact())\n\n        if not da.requested_domain:\n            if \"requested_domain\" in app and app[\"requested_domain\"] is not None:\n                da.requested_domain, _ = DraftDomain.objects.get_or_create(name=app[\"requested_domain\"])\n            else:\n                da.requested_domain = DraftDomain.objects.create(name=cls.fake_dot_gov())\n\n    @classmethod\n    def _set_many_to_many_relations(cls, da: DomainApplication, app: dict):\n        \"\"\"Helper method used by `load`.\"\"\"\n        if \"other_contacts\" in app:\n            for contact in app[\"other_contacts\"]:\n                da.other_contacts.add(Contact.objects.get_or_create(**contact)[0])\n        elif not da.other_contacts.exists():\n            other_contacts = [\n                Contact.objects.create(**cls.fake_contact()) for _ in range(random.randint(0, 3))  # nosec\n            ]\n            da.other_contacts.add(*other_contacts)\n\n        if \"current_websites\" in app:\n            for website in app[\"current_websites\"]:\n                da.current_websites.add(Website.objects.get_or_create(website=website)[0])\n        elif not da.current_websites.exists():\n            current_websites = [\n                Website.objects.create(website=fake.uri()) for _ in range(random.randint(0, 3))  # nosec\n            ]\n            da.current_websites.add(*current_websites)\n\n        if \"alternative_domains\" in app:\n            for domain in app[\"alternative_domains\"]:\n                da.alternative_domains.add(Website.objects.get_or_create(website=domain)[0])\n        elif not da.alternative_domains.exists():\n            alternative_domains = [\n                Website.objects.create(website=cls.fake_dot_gov()) for _ in range(random.randint(0, 3))  # nosec\n            ]\n            da.alternative_domains.add(*alternative_domains)\n\n    @classmethod\n    def load(cls):\n        \"\"\"Creates domain applications for each user in the database.\"\"\"\n        logger.info(\"Going to load %s domain applications\" % len(cls.DA))\n        try:\n            users = list(User.objects.all())  # force evaluation to catch db errors\n        except Exception as e:\n            logger.warning(e)\n            return\n\n        for user in users:\n            logger.debug(\"Loading domain applications for %s\" % user)\n            for app in cls.DA:\n                try:\n                    da, _ = DomainApplication.objects.get_or_create(\n                        creator=user,\n                        organization_name=app[\"organization_name\"],\n                    )\n                    cls._set_non_foreign_key_fields(da, app)\n                    cls._set_foreign_key_fields(da, app, user)\n                    da.save()\n                    cls._set_many_to_many_relations(da, app)\n                except Exception as e:\n                    logger.warning(e)\n\n\nclass DomainFixture(DomainApplicationFixture):\n\n    \"\"\"Create one domain and permissions on it for each user.\"\"\"\n\n    @classmethod\n    def load(cls):\n        try:\n            users = list(User.objects.all())  # force evaluation to catch db errors\n        except Exception as e:\n            logger.warning(e)\n            return\n\n        for user in users:\n            # approve one of each users in review status domains\n            application = DomainApplication.objects.filter(\n                creator=user, status=DomainApplication.ApplicationStatus.IN_REVIEW\n            ).last()\n            logger.debug(f\"Approving {application} for {user}\")\n\n            # We don't want fixtures sending out real emails to\n            # fake email addresses, so we just skip that and log it instead\n            application.approve(send_email=False)\n            application.save()\n", "path": "src/registrar/fixtures_applications.py"}]}