diff --git a/.github/workflows/daily-csv-upload.yaml b/.github/workflows/daily-csv-upload.yaml new file mode 100644 index 000000000..724a19457 --- /dev/null +++ b/.github/workflows/daily-csv-upload.yaml @@ -0,0 +1,33 @@ +name: Upload current-full.csv and current-federal.csv +run-name: Upload current-full.csv and current-federal.csv + +on: + schedule: + # Runs every day at 5 AM UTC. + - cron: "0 5 * * *" + +jobs: + upload-reports: + runs-on: ubuntu-latest + env: + CF_USERNAME: CF_${{ secrets.CF_REPORT_ENV }}_USERNAME + CF_PASSWORD: CF_${{ secrets.CF_REPORT_ENV }}_PASSWORD + steps: + - name: Generate current-federal.csv + uses: cloud-gov/cg-cli-tools@main + with: + cf_username: ${{ secrets[env.CF_USERNAME] }} + cf_password: ${{ secrets[env.CF_PASSWORD] }} + cf_org: cisa-dotgov + cf_space: ${{ secrets.CF_REPORT_ENV }} + cf_command: "run-task getgov-${{ secrets.CF_REPORT_ENV }} --command 'python manage.py generate_current_federal_report' --name federal" + + - name: Generate current-full.csv + uses: cloud-gov/cg-cli-tools@main + with: + cf_username: ${{ secrets[env.CF_USERNAME] }} + cf_password: ${{ secrets[env.CF_PASSWORD] }} + cf_org: cisa-dotgov + cf_space: ${{ secrets.CF_REPORT_ENV }} + cf_command: "run-task getgov-${{ secrets.CF_REPORT_ENV }} --command 'python manage.py generate_current_full_report' --name full" + diff --git a/.github/workflows/deploy-development.yaml b/.github/workflows/deploy-development.yaml index 13aeb3993..562b2b11f 100644 --- a/.github/workflows/deploy-development.yaml +++ b/.github/workflows/deploy-development.yaml @@ -15,7 +15,6 @@ on: jobs: deploy-development: - if: ${{ github.ref_type == 'tag' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/docs/developer/README.md b/docs/developer/README.md index 9cfdb2149..57985d6e2 100644 --- a/docs/developer/README.md +++ b/docs/developer/README.md @@ -295,7 +295,7 @@ sudo sntp -sS time.nist.gov ``` ## Connection pool -To handle our connection to the registry, we utilize a connection pool to keep a socket open to increase responsiveness. In order to accomplish this, we are utilizing a heavily modified version of the (geventconnpool)[https://github.com/rasky/geventconnpool] library. +To handle our connection to the registry, we utilize a connection pool to keep a socket open to increase responsiveness. In order to accomplish this, we are utilizing a heavily modified version of the [geventconnpool](https://github.com/rasky/geventconnpool) library. ### Settings The config for the connection pool exists inside the `settings.py` file. @@ -319,4 +319,36 @@ Our connection pool has a built-in `pool_status` object which you can call at an 5. `print(registry.pool_status.connection_success)` * Should return true -If you have multiple instances (staging for example), then repeat commands 1-5 for each instance you want to test. \ No newline at end of file +If you have multiple instances (staging for example), then repeat commands 1-5 for each instance you want to test. + +## Adding a S3 instance to your sandbox +This can either be done through the CLI, or through the cloud.gov dashboard. Generally, it is better to do it through the dashboard as it handles app binding for you. + +To associate a S3 instance to your sandbox, follow these steps: +1. Navigate to https://dashboard.fr.cloud.gov/login +2. Select your sandbox from the `Applications` tab +3. Click `Services` on the application nav bar +4. Add a new service (plus symbol) +5. Click `Marketplace Service` +6. On the `Select the service` dropdown, select `s3` +7. Under the dropdown on `Select Plan`, select `basic-sandbox` +8. Under `Service Instance` enter `getgov-s3` for the name + +See this [resource](https://cloud.gov/docs/services/s3/) for information on associating an S3 instance with your sandbox through the CLI. + +### Testing your S3 instance locally +To test the S3 bucket associated with your sandbox, you will need to add four additional variables to your `.env` file. These are as follows: + +``` +AWS_S3_ACCESS_KEY_ID = "{string value of `access_key_id` in getgov-s3}" +AWS_S3_SECRET_ACCESS_KEY = "{string value of `secret_access_key` in getgov-s3}" +AWS_S3_REGION = "{string value of `region` in getgov-s3}" +AWS_S3_BUCKET_NAME = "{string value of `bucket` in getgov-s3}" +``` + +You can view these variables by running the following command: +``` +cf env getgov-{app name} +``` + +Then, copy the variables under the section labled `s3`. \ No newline at end of file diff --git a/docs/developer/generating-emails-guide.md b/docs/developer/generating-emails-guide.md new file mode 100644 index 000000000..383fc31ac --- /dev/null +++ b/docs/developer/generating-emails-guide.md @@ -0,0 +1,86 @@ +**Below is a step by step guide for generating emails (of each type) in our application. These instructions are UI facing, with the assumption that the user has analyst (or above) permissions.** + +## Domain Invitation +- Starting Location: Home page +- Workflow: (Domains Table) Manage domain +- Workflow Step: Click "Manage" -> Click "Domain managers" -> Click "Add a domain manager" -> (enter email) -> Click "Add user" +- [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/domain_invitation.txt) + +### Domain Invitation Subject +- Notes: Subject line of the "Domain Invitation" email +- [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/domain_invitation_subject.txt) + +## Domain Request Withdrawn +- Starting Location: Home page +- Workflow: (Domain requests Table) Manage domain +- Workflow Step: Click "Manage" -> Click "Withdraw request" -> (confirmation prompt) -> Click "Withdraw request" (inside prompt) +- Notes: You can also do this through Django Admin by switching a domain of status "submitted" to "withdrawn", but you need to be the submitter (email listed on Your Contact Information). +- [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/domain_request_withdrawn.txt) + +### Domain Request Withdrawn Subject +- Notes: Subject line of the "Domain Request Withdrawn" email +- [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/domain_request_withdrawn_subject.txt) + +## Status Change Action Needed +- Starting Location: Django Admin +- Workflow: Analyst Admin +- Workflow Step: Click "Domain applications" -> Click an application with a status of "in review" or "rejected" -> Click status dropdown -> (select "action needed") -> click "Save" +- Notes: Note that this will send an email to the submitter (email listed on Your Contact Information). To test this with your own email, you need to create an application, set the status to either "in review" or "rejected" (and click save), then set the status to "action needed". This will send you an email. +- [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/status_change_action_needed.txt) + +### Status Change Action Needed Subject +- Notes: Subject line of the "Status Change Action Needed" email +- [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/status_change_action_needed_subject.txt) + +## Status Change in Review +- Starting Location: Django Admin +- Workflow: Analyst Admin +- Workflow Step: Click "Domain applications" -> Click an application with a status of "submitted" -> Click status dropdown -> (select "In review") -> click "Save" +- Notes: Note that this will send an email to the submitter (email listed on Your Contact Information). To test this with your own email, you need to create an application, then set the status to "In review". This will send you an email. +- [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/status_change_approved.txt) + +### Status Change in Review Subject +- Notes: This is the subject line of the "Status Change In Review" email +- [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/status_change_in_review_subject.txt) + +## Status Change Approved +- Starting Location: Django Admin +- Workflow: Analyst Admin +- Workflow Step: Click "Domain applications" -> Click an application in a status of "submitted", "In review", "rejected", or "ineligible" -> Click status dropdown -> (select "approved") -> click "Save" +- Notes: Note that this will send an email to the submitter (email listed on Your Contact Information). To test this with your own email, you need to create an application, then set the status to "approved". This will send you an email. +- [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/status_change_approved.txt) + +### Status Change Approved Subject +- Notes: This is the subject line of the "Status Change Approved" email +- [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/status_change_approved_subject.txt) + +## Status Change Rejected +- Starting Location: Django Admin +- Workflow: Analyst Admin +- Workflow Step: Click "Domain applications" -> Click an application in a status of "In review", or "approved" -> Click status dropdown -> (select "rejected") -> click "Save" +- Notes: Note that this will send an email to the submitter (email listed on Your Contact Information). To test this with your own email, you need to create an application, then set the status to "in review" (and click save). Then, go back to the same application and set the status to "rejected". This will send you an email. +- [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/status_change_rejected.txt) + +### Status Change Rejected Subject +- Notes: Subject line of the "Status Change Rejected" email +- [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/status_change_rejected_subject.txt) + +## Submission Confirmation +- Starting Location: Home Page +- Workflow: Start domain request +- Workflow Step: Click "Start a new domain request" -> (fill out the form) -> On the last step ("Review and submit your domain request "), click "Submit your domain request" +- Notes: Note that this will send an email to the submitter (email listed on Your Contact Information) +- [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/submission_confirmation.txt) + +### Submission Confirmation Subject +- Notes: This is the subject line of the "Submission Confirmation Subject" email +- [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/submission_confirmation_subject.txt) + +## Transition Domain Invitation +- Notes: This email is generated during the migration process, meaning that there is no using-facing method to receive this email. This email will be sent out when the following conditions are true: a) The domain exists in the data that Verisign sent us, b) the transition domain script ran successfully, and c) invitations are sent out +- [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/transition_domain_invitation.txt) + +### Transition Domain Invitation Subject +- Notes: This is the subject line of the "Transition Domain Invitation" email +- [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/transition_domain_invitation_subject.txt) + diff --git a/docs/developer/migration-troubleshooting.md b/docs/developer/migration-troubleshooting.md new file mode 100644 index 000000000..25187ef13 --- /dev/null +++ b/docs/developer/migration-troubleshooting.md @@ -0,0 +1,123 @@ +## Troubleshooting + +### Your toolkit +For a general overview, read [this documentation](https://www.algotech.solutions/blog/python/django-migrations-and-how-to-manage-conflicts/) + + +Some common commands: +- docker-compose exec app bash -- gets you into bash +- ./manage.py showmigrations -- shows the current migrations that are finished, all should have [x] +- ./manage.py makemigrations -- makes the migration +- ./manage.py showmigrations -- now you should see the new/updated migration with a [ ] +- ./manage.py migrate [folder name here, ie registrar] -- applies those changes to db for specific folder +- ./manage.py showmigrations -- the migration changes should now have a [x] by it + + +## Scenarios + +### Scenario 1: Conflicting migrations on local + +If you get conflicting migrations on local, you probably have a new migration on your branch and you merged main which had new migrations as well. Do NOT merge migrations together. + +Assuming your local migration is `40_local_migration` and the migration from main is `40_some_migration_from_main`: +- Delete `40_local_migration` +- Run `docker-compose exec app ./manage.py makemigrations` +- Run `docker-compose down` +- Run `docker-compose up` +- Run `docker-compose exec app ./manage.py migrate` + +You should end up with `40_some_migration_from_main`, `41_local_migration` + +Alternatively, assuming that the conflicting migrations are not dependent on each other, you can manually edit the migration file such that your new migration is incremented by one (file name, and definition inside the file) but this approach is not recommended. + +### Scenario 2: Conflicting migrations on sandbox + +This occurs when the logs return the following: +>Conflicting migrations detected; multiple leaf nodes in the migration graph: (0040_example, 0041_example in base). +To fix them run 'python manage.py makemigrations --merge' + +This happens when you swap branches on your sandbox that contain diverging leaves (eg: 0040_example, 0041_example). The fix is to go into the sandbox, delete one of these leaves, fake run the preceding migration, hand run the remaining previously conflicting leaf, fake run the last migration: + +- `cf login -a api.fr.cloud.gov --sso` +- `cf ssh getgov-` +- `/tmp/lifecycle/shell` +- `cf run-task getgov- --wait --command 'python manage.py migrate registrar 39_previous_miration --fake' --name migrate` +- `cf run-task getgov- --wait --command 'python manage.py migrate registrar 41_example_migration' --name migrate` +- `cf run-task getgov- --wait --command 'python manage.py migrate registrar 45_last_migration --fake' --name migrate` + +Then, navigate to and delete the offending migration. In this case, it is 0041_example_migration. + +### Scenario 3: Migrations ran incorrectly, and migrate no longer works (sandbox) + +This has happened when updating user perms (so running a new data migration). Something is off with the update on the sandbox and you need to run that last data migration again: +- `cf login -a api.fr.cloud.gov --sso` +- `cf run-task getgov- --wait --command 'python manage.py migrate registrar 39_penultimate_miration --fake' --name migrate` +- `cf run-task getgov- --wait --command 'python manage.py migrate' --name migrate` + +### Scenario 4: All migrations refuse to load due to existing duplicates on sandboxes + +This typically happens with a DB conflict that prevents 001_initial from loading. For instance, let's say all migrations have ran successfully before, and a zero command is ran to reset everything. This can lead to a catastrophic issue with your postgres database. + +To diagnose this issue, you will have to manually delete tables using the psql shell environment. If you are in a production environment and cannot lose that data, then you will need some method of backing that up and reattaching it to the table. + +1. `cf login -a api.fr.cloud.gov --sso` +2. Run `cf connect-to-service -no-client getgov-{environment_name} getgov-{environment_name}-database` to open a SSH tunnel +3. Run `psql -h localhost -p {port} -U {username} -d {broker_name}` +4. Open a new terminal window and run `cf ssh getgov{environment_name}` +5. Within that window, run `tmp/lifecycle/shell` +6. Within that window, run `./manage.py migrate` and observe which tables are duplicates + +Afterwards, go back to your psql instance. Run the following for each problematic table: + +7. `DROP TABLE {table_name} CASCADE` + +**WARNING:** this will permanently erase data! Be careful when doing this and exercise common sense. + +Then, run `./manage.py migrate` again and repeat step 7 for each table which returns this error. +After these errors are resolved, follow instructions in the other scenarios if applicable. + +### Scenario 5: Permissions group exist, but my users cannot log onto the sandbox + +This is most likely due to fixtures not running or fixtures running before the data creating migration. Simple run fixtures again (WARNING: This applies to dev sandboxes only. We never want to rerun fixtures on a stable environment) + +- `cf login -a api.fr.cloud.gov --sso` +- `cf run-task getgov- --command "./manage.py load" --name fixtures` + +### Scenario 6: Data is corrupted on the sandbox + +Example: there are extra columns created on a table by an old migration long since gone from the code. In that case, you may have to tunnel into your DB on the sandbox and hand-delete these columns. See scenario #4 if you are running into duplicate table definitions. Also see [this documentation](docs/developer/database-access.md) for a good reference here: + +- `cf login -a api.fr.cloud.gov --sso` +- Open a new terminal window and run `cf ssh getgov{environment_name}` +- Run `tmp/lifecycle/shell` +- Run `./manage.py migrate` and observe which tables have invalid column definitions +- Run the `\l` command to see all of the databases that are present +- `\c cgawsbrokerprodlgi635s6c0afp8w` (assume cgawsbrokerprodlgi635s6c0afp8w is your DB) +‘\dt’ to see the tables +- `SELECT * FROM {bad_table};` +- `alter table registrar_domain drop {bad_column};` + +### Scenario 7: Continual 500 error for the registrar + your requests (login, clicking around, etc) are not showing up in the logstream + +Example: You are able to log in and access the /admin page, but when you arrive at the registrar you keep getting 500 errors and your log-ins any API calls you make via the UI does not show up in the log stream. And you feel like you’re starting to lose your marbles. + +In the CLI, run the command `cf routes` +If you notice that your route of `getgov-.app.cloud.gov` is pointing two apps, then that is probably the major issue of the 500 error. (ie mine was pointing at `getgov-.app.cloud.gov` AND `cisa-dotgov` +In the CLI, run the command `cf apps` to check that it has an app running called `cisa-dotgov`. If so, there’s the error! +Essentially this shows that your requests were being handled by two completely separate applications and that’s why some requests aren’t being located. +To resolve this issue, remove the app named `cisa-dotgov` from this space. +Test out the sandbox from there and it should be working! + +**Debug connectivity** + +dig https://getgov-.app.cloud.gov (domain information groper, gets DNS nameserver information) +curl -v https://getgov-.app.cloud.gov/ --resolve 'getgov-.app.cloud.gov:' (this gets you access to ping to it) +You should be able to play around with your sandbox and see from the curl command above that it’s being pinged. This command is basically log stream, but gives you full access to make sure you can ping the sandbox manually +https://cisa-corp.slack.com/archives/C05BGB4L5NF/p1697810600723069 + +### Scenario 8: Can’t log into sandbox, permissions do not exist + +- Fake migrate the migration that’s before the last data creation migration +- Run the last data creation migration (AND ONLY THAT ONE) +- Fake migrate the last migration in the migration list +- Rerun fixtures diff --git a/src/api/views.py b/src/api/views.py index 85ae021c9..5e3ab3a89 100644 --- a/src/api/views.py +++ b/src/api/views.py @@ -1,7 +1,7 @@ """Internal API views""" from django.apps import apps from django.views.decorators.http import require_http_methods -from django.http import JsonResponse +from django.http import HttpResponse, JsonResponse from django.utils.safestring import mark_safe from registrar.templatetags.url_helpers import public_site_url @@ -13,6 +13,8 @@ from login_required import login_not_required from cachetools.func import ttl_cache +from registrar.utility.s3_bucket import S3ClientError, S3ClientHelper + DOMAIN_FILE_URL = "https://raw.githubusercontent.com/cisagov/dotgov-data/main/current-full.csv" @@ -95,3 +97,36 @@ def available(request, domain=""): return JsonResponse({"available": False, "message": DOMAIN_API_MESSAGES["unavailable"]}) except Exception: return JsonResponse({"available": False, "message": DOMAIN_API_MESSAGES["error"]}) + + +@require_http_methods(["GET"]) +@login_not_required +def get_current_full(request, file_name="current-full.csv"): + """This will return the file content of current-full.csv which is the command + output of generate_current_full_report.py. This command iterates through each Domain + and returns a CSV representation.""" + return serve_file(file_name) + + +@require_http_methods(["GET"]) +@login_not_required +def get_current_federal(request, file_name="current-federal.csv"): + """This will return the file content of current-federal.csv which is the command + output of generate_current_federal_report.py. This command iterates through each Domain + and returns a CSV representation.""" + return serve_file(file_name) + + +def serve_file(file_name): + """Downloads a file based on a given filepath. Returns a 500 if not found.""" + s3_client = S3ClientHelper() + # Serve the CSV file. If not found, an exception will be thrown. + # This will then be caught by flat, causing it to not read it - which is what we want. + try: + file = s3_client.get_file(file_name, decode_to_utf=True) + except S3ClientError as err: + # TODO - #1317: Notify operations when auto report generation fails + raise err + + response = HttpResponse(file) + return response diff --git a/src/docker-compose.yml b/src/docker-compose.yml index 90ce1acb0..c9b78fd8e 100644 --- a/src/docker-compose.yml +++ b/src/docker-compose.yml @@ -51,6 +51,11 @@ services: # AWS credentials - AWS_ACCESS_KEY_ID - AWS_SECRET_ACCESS_KEY + # AWS S3 bucket credentials + - AWS_S3_ACCESS_KEY_ID + - AWS_S3_SECRET_ACCESS_KEY + - AWS_S3_REGION + - AWS_S3_BUCKET_NAME stdin_open: true tty: true ports: diff --git a/src/registrar/admin.py b/src/registrar/admin.py index e7030c2d3..429bd762f 100644 --- a/src/registrar/admin.py +++ b/src/registrar/admin.py @@ -1,6 +1,7 @@ import logging from django import forms from django.http import HttpResponse +from django.shortcuts import redirect from django_fsm import get_available_FIELD_transitions from django.contrib import admin, messages from django.contrib.auth.admin import UserAdmin as BaseUserAdmin @@ -117,6 +118,15 @@ class ListHeaderAdmin(AuditedAdmin): ) return filters + # customize the help_text for all formfields for manytomany + def formfield_for_manytomany(self, db_field, request, **kwargs): + formfield = super().formfield_for_manytomany(db_field, request, **kwargs) + formfield.help_text = ( + formfield.help_text + + " If more than one value is selected, the change/delete/view actions will be disabled." + ) + return formfield + class UserContactInline(admin.StackedInline): """Edit a user's profile on the user page.""" @@ -351,6 +361,17 @@ class UserDomainRoleAdmin(ListHeaderAdmin): autocomplete_fields = ["user", "domain"] + # Fixes a bug where non-superusers are redirected to the main page + def delete_view(self, request, object_id, extra_context=None): + """Custom delete_view implementation that specifies redirect behaviour""" + response = super().delete_view(request, object_id, extra_context) + + if isinstance(response, HttpResponseRedirect) and not request.user.has_perm("registrar.full_access_permission"): + url = reverse("admin:registrar_userdomainrole_changelist") + return redirect(url) + else: + return response + class DomainInvitationAdmin(ListHeaderAdmin): """Custom domain invitation admin class.""" @@ -445,7 +466,7 @@ class DomainInformationAdmin(ListHeaderAdmin): "No other employees from your organization?", {"fields": ["no_other_contacts_rationale"]}, ), - ("Anything else we should know?", {"fields": ["anything_else"]}), + ("Anything else?", {"fields": ["anything_else"]}), ( "Requirements for operating .gov domains", {"fields": ["is_policy_acknowledged"]}, @@ -464,6 +485,17 @@ class DomainInformationAdmin(ListHeaderAdmin): "is_policy_acknowledged", ] + # For each filter_horizontal, init in admin js extendFilterHorizontalWidgets + # to activate the edit/delete/view buttons + filter_horizontal = ("other_contacts",) + + # lists in filter_horizontal are not sorted properly, sort them + # by first_name + def formfield_for_manytomany(self, db_field, request, **kwargs): + if db_field.name in ("other_contacts",): + kwargs["queryset"] = models.Contact.objects.all().order_by("first_name") # Sort contacts + return super().formfield_for_manytomany(db_field, request, **kwargs) + def get_readonly_fields(self, request, obj=None): """Set the read-only state on form elements. We have 1 conditions that determine which fields are read-only: @@ -580,7 +612,7 @@ class DomainApplicationAdmin(ListHeaderAdmin): "No other employees from your organization?", {"fields": ["no_other_contacts_rationale"]}, ), - ("Anything else we should know?", {"fields": ["anything_else"]}), + ("Anything else?", {"fields": ["anything_else"]}), ( "Requirements for operating .gov domains", {"fields": ["is_policy_acknowledged"]}, @@ -600,6 +632,15 @@ class DomainApplicationAdmin(ListHeaderAdmin): "is_policy_acknowledged", ] + filter_horizontal = ("current_websites", "alternative_domains", "other_contacts") + + # lists in filter_horizontal are not sorted properly, sort them + # by website + def formfield_for_manytomany(self, db_field, request, **kwargs): + if db_field.name in ("current_websites", "alternative_domains"): + kwargs["queryset"] = models.Website.objects.all().order_by("website") # Sort websites + return super().formfield_for_manytomany(db_field, request, **kwargs) + # Trigger action when a fieldset is changed def save_model(self, request, obj, form, change): if obj and obj.creator.status != models.User.RESTRICTED: @@ -728,6 +769,16 @@ class DomainInformationInline(admin.StackedInline): fieldsets = DomainInformationAdmin.fieldsets analyst_readonly_fields = DomainInformationAdmin.analyst_readonly_fields + # For each filter_horizontal, init in admin js extendFilterHorizontalWidgets + # to activate the edit/delete/view buttons + filter_horizontal = ("other_contacts",) + + # lists in filter_horizontal are not sorted properly, sort them + # by first_name + def formfield_for_manytomany(self, db_field, request, **kwargs): + if db_field.name in ("other_contacts",): + kwargs["queryset"] = models.Contact.objects.all().order_by("first_name") # Sort contacts + return super().formfield_for_manytomany(db_field, request, **kwargs) def get_readonly_fields(self, request, obj=None): return DomainInformationAdmin.get_readonly_fields(self, request, obj=None) diff --git a/src/registrar/assets/js/get-gov-admin.js b/src/registrar/assets/js/get-gov-admin.js index 3b9f19a49..53eeb22a3 100644 --- a/src/registrar/assets/js/get-gov-admin.js +++ b/src/registrar/assets/js/get-gov-admin.js @@ -47,4 +47,231 @@ function openInNewTab(el, removeAttribute = false){ } prepareDjangoAdmin(); -})(); \ No newline at end of file +})(); + +/** + * An IIFE to listen to changes on filter_horizontal and enable or disable the change/delete/view buttons as applicable + * + */ +(function extendFilterHorizontalWidgets() { + // Initialize custom filter_horizontal widgets; each widget has a "from" select list + // and a "to" select list; initialization is based off of the presence of the + // "to" select list + checkToListThenInitWidget('id_other_contacts_to', 0); + checkToListThenInitWidget('id_domain_info-0-other_contacts_to', 0); + checkToListThenInitWidget('id_current_websites_to', 0); + checkToListThenInitWidget('id_alternative_domains_to', 0); +})(); + +// Function to check for the existence of the "to" select list element in the DOM, and if and when found, +// initialize the associated widget +function checkToListThenInitWidget(toListId, attempts) { + let toList = document.getElementById(toListId); + attempts++; + + if (attempts < 6) { + if ((toList !== null)) { + // toList found, handle it + // Add an event listener on the element + // Add disabled buttons on the element's great-grandparent + initializeWidgetOnToList(toList, toListId); + } else { + // Element not found, check again after a delay + setTimeout(() => checkToListThenInitWidget(toListId, attempts), 1000); // Check every 1000 milliseconds (1 second) + } + } +} + +// Initialize the widget: +// add related buttons to the widget for edit, delete and view +// add event listeners on the from list, the to list, and selector buttons which either enable or disable the related buttons +function initializeWidgetOnToList(toList, toListId) { + // create the change button + let changeLink = createAndCustomizeLink( + toList, + toListId, + 'related-widget-wrapper-link change-related', + 'Change', + '/public/admin/img/icon-changelink.svg', + { + 'contacts': '/admin/registrar/contact/__fk__/change/?_to_field=id&_popup=1', + 'websites': '/admin/registrar/website/__fk__/change/?_to_field=id&_popup=1', + 'alternative_domains': '/admin/registrar/website/__fk__/change/?_to_field=id&_popup=1', + }, + true, + true + ); + + let hasDeletePermission = hasDeletePermissionOnPage(); + + let deleteLink = null; + if (hasDeletePermission) { + // create the delete button if user has permission to delete + deleteLink = createAndCustomizeLink( + toList, + toListId, + 'related-widget-wrapper-link delete-related', + 'Delete', + '/public/admin/img/icon-deletelink.svg', + { + 'contacts': '/admin/registrar/contact/__fk__/delete/?_to_field=id&_popup=1', + 'websites': '/admin/registrar/website/__fk__/delete/?_to_field=id&_popup=1', + 'alternative_domains': '/admin/registrar/website/__fk__/delete/?_to_field=id&_popup=1', + }, + true, + false + ); + } + + // create the view button + let viewLink = createAndCustomizeLink( + toList, + toListId, + 'related-widget-wrapper-link view-related', + 'View', + '/public/admin/img/icon-viewlink.svg', + { + 'contacts': '/admin/registrar/contact/__fk__/change/?_to_field=id', + 'websites': '/admin/registrar/website/__fk__/change/?_to_field=id', + 'alternative_domains': '/admin/registrar/website/__fk__/change/?_to_field=id', + }, + false, + false + ); + + // identify the fromList element in the DOM + let fromList = toList.closest('.selector').querySelector(".selector-available select"); + + fromList.addEventListener('click', function(event) { + handleSelectClick(fromList, changeLink, deleteLink, viewLink); + }); + + toList.addEventListener('click', function(event) { + handleSelectClick(toList, changeLink, deleteLink, viewLink); + }); + + // Disable buttons when the selectors are interacted with (items are moved from one column to the other) + let selectorButtons = []; + selectorButtons.push(toList.closest(".selector").querySelector(".selector-chooseall")); + selectorButtons.push(toList.closest(".selector").querySelector(".selector-add")); + selectorButtons.push(toList.closest(".selector").querySelector(".selector-remove")); + + selectorButtons.forEach((selector) => { + selector.addEventListener("click", ()=>{disableRelatedWidgetButtons(changeLink, deleteLink, viewLink)}); + }); +} + +// create and customize the button, then add to the DOM, relative to the toList +// toList - the element in the DOM for the toList +// toListId - the ID of the element in the DOM +// className - className to add to the created link +// action - the action to perform on the item {change, delete, view} +// imgSrc - the img.src for the created link +// dataMappings - dictionary which relates toListId to href for the created link +// dataPopup - boolean for whether the link should produce a popup window +// firstPosition - boolean indicating if link should be first position in list of links, otherwise, should be last link +function createAndCustomizeLink(toList, toListId, className, action, imgSrc, dataMappings, dataPopup, firstPosition) { + // Create a link element + var link = document.createElement('a'); + + // Set class attribute for the link + link.className = className; + + // Set id + // Determine function {change, link, view} from the className + // Add {function}_ to the beginning of the string + let modifiedLinkString = className.split('-')[0] + '_' + toListId; + // Remove '_to' from the end of the string + modifiedLinkString = modifiedLinkString.replace('_to', ''); + link.id = modifiedLinkString; + + // Set data-href-template + for (const [idPattern, template] of Object.entries(dataMappings)) { + if (toListId.includes(idPattern)) { + link.setAttribute('data-href-template', template); + break; // Stop checking once a match is found + } + } + + if (dataPopup) + link.setAttribute('data-popup', 'yes'); + + link.setAttribute('title-template', action + " selected item") + link.title = link.getAttribute('title-template'); + + // Create an 'img' element + var img = document.createElement('img'); + + // Set attributes for the new image + img.src = imgSrc; + img.alt = action; + + // Append the image to the link + link.appendChild(img); + + let relatedWidgetWrapper = toList.closest('.related-widget-wrapper'); + // If firstPosition is true, insert link as the first child element + if (firstPosition) { + relatedWidgetWrapper.insertBefore(link, relatedWidgetWrapper.children[0]); + } else { + // otherwise, insert the link prior to the last child (which is a div) + // and also prior to any text elements immediately preceding the last + // child node + var lastChild = relatedWidgetWrapper.lastChild; + + // Check if lastChild is an element node (not a text node, comment, etc.) + if (lastChild.nodeType === 1) { + var previousSibling = lastChild.previousSibling; + // need to work around some white space which has been inserted into the dom + while (previousSibling.nodeType !== 1) { + previousSibling = previousSibling.previousSibling; + } + relatedWidgetWrapper.insertBefore(link, previousSibling.nextSibling); + } + } + + // Return the link, which we'll use in the disable and enable functions + return link; +} + +// Either enable or disable widget buttons when select is clicked. Action (enable or disable) taken depends on the count +// of selected items in selectElement. If exactly one item is selected, buttons are enabled, and urls for the buttons are +// associated with the selected item +function handleSelectClick(selectElement, changeLink, deleteLink, viewLink) { + + // If one item is selected (across selectElement and relatedSelectElement), enable buttons; otherwise, disable them + if (selectElement.selectedOptions.length === 1) { + // enable buttons for selected item in selectElement + enableRelatedWidgetButtons(changeLink, deleteLink, viewLink, selectElement.selectedOptions[0].value, selectElement.selectedOptions[0].text); + } else { + disableRelatedWidgetButtons(changeLink, deleteLink, viewLink); + } +} + +// return true if there exist elements on the page with classname of delete-related. +// presence of one or more of these elements indicates user has permission to delete +function hasDeletePermissionOnPage() { + return document.querySelector('.delete-related') != null +} + +function disableRelatedWidgetButtons(changeLink, deleteLink, viewLink) { + changeLink.removeAttribute('href'); + changeLink.setAttribute('title', changeLink.getAttribute('title-template')); + if (deleteLink) { + deleteLink.removeAttribute('href'); + deleteLink.setAttribute('title', deleteLink.getAttribute('title-template')); + } + viewLink.removeAttribute('href'); + viewLink.setAttribute('title', viewLink.getAttribute('title-template')); +} + +function enableRelatedWidgetButtons(changeLink, deleteLink, viewLink, elementPk, elementText) { + changeLink.setAttribute('href', changeLink.getAttribute('data-href-template').replace('__fk__', elementPk)); + changeLink.setAttribute('title', changeLink.getAttribute('title-template').replace('selected item', elementText)); + if (deleteLink) { + deleteLink.setAttribute('href', deleteLink.getAttribute('data-href-template').replace('__fk__', elementPk)); + deleteLink.setAttribute('title', deleteLink.getAttribute('title-template').replace('selected item', elementText)); + } + viewLink.setAttribute('href', viewLink.getAttribute('data-href-template').replace('__fk__', elementPk)); + viewLink.setAttribute('title', viewLink.getAttribute('title-template').replace('selected item', elementText)); +} diff --git a/src/registrar/assets/sass/_theme/_base.scss b/src/registrar/assets/sass/_theme/_base.scss index 668a6ace6..1d936a255 100644 --- a/src/registrar/assets/sass/_theme/_base.scss +++ b/src/registrar/assets/sass/_theme/_base.scss @@ -37,9 +37,9 @@ body { @include typeset('sans', 'xl', 2); color: color('primary-darker'); } - + .usa-nav__primary { - margin-top: units(1); + margin-top:units(1); } .section--outlined { diff --git a/src/registrar/config/settings.py b/src/registrar/config/settings.py index 7f20c8129..9bdcd4e98 100644 --- a/src/registrar/config/settings.py +++ b/src/registrar/config/settings.py @@ -33,11 +33,20 @@ env = environs.Env() # Get secrets from Cloud.gov user provided service, if exists # If not, get secrets from environment variables key_service = AppEnv().get_service(name="getgov-credentials") + + +# Get secrets from Cloud.gov user provided s3 service, if it exists +s3_key_service = AppEnv().get_service(name="getgov-s3") + if key_service and key_service.credentials: + if s3_key_service and s3_key_service.credentials: + # Concatenate the credentials from our S3 service into our secret service + key_service.credentials.update(s3_key_service.credentials) secret = key_service.credentials.get else: secret = env + # # # ### # Values obtained externally # # # # ### @@ -58,6 +67,12 @@ secret_key = secret("DJANGO_SECRET_KEY") secret_aws_ses_key_id = secret("AWS_ACCESS_KEY_ID", None) secret_aws_ses_key = secret("AWS_SECRET_ACCESS_KEY", None) +# These keys are present in a getgov-s3 instance, or they can be defined locally +aws_s3_region_name = secret("region", None) or secret("AWS_S3_REGION", None) +secret_aws_s3_key_id = secret("access_key_id", None) or secret("AWS_S3_ACCESS_KEY_ID", None) +secret_aws_s3_key = secret("secret_access_key", None) or secret("AWS_S3_SECRET_ACCESS_KEY", None) +secret_aws_s3_bucket_name = secret("bucket", None) or secret("AWS_S3_BUCKET_NAME", None) + secret_registry_cl_id = secret("REGISTRY_CL_ID") secret_registry_password = secret("REGISTRY_PASSWORD") secret_registry_cert = b64decode(secret("REGISTRY_CERT", "")) @@ -257,7 +272,14 @@ AUTH_USER_MODEL = "registrar.User" AWS_ACCESS_KEY_ID = secret_aws_ses_key_id AWS_SECRET_ACCESS_KEY = secret_aws_ses_key AWS_REGION = "us-gov-west-1" -# https://boto3.amazonaws.com/v1/documentation/api/latest/guide/retries.html#standard-retry-mode + +# Configuration for accessing AWS S3 +AWS_S3_ACCESS_KEY_ID = secret_aws_s3_key_id +AWS_S3_SECRET_ACCESS_KEY = secret_aws_s3_key +AWS_S3_REGION = aws_s3_region_name +AWS_S3_BUCKET_NAME = secret_aws_s3_bucket_name + +# https://boto3.amazonaws.com/v1/documentation/latest/guide/retries.html#standard-retry-mode AWS_RETRY_MODE: Final = "standard" # base 2 exponential backoff with max of 20 seconds: AWS_MAX_ATTEMPTS = 3 @@ -518,7 +540,7 @@ OIDC_PROVIDERS = { "response_type": "code", "scope": ["email", "profile:name", "phone"], "user_info_request": ["email", "first_name", "last_name", "phone"], - "acr_value": "http://idmanagement.gov/ns/assurance/ial/2", + "acr_value": "http://idmanagement.gov/ns/assurance/ial/1", }, "client_registration": { "client_id": "cisa_dotgov_registrar", @@ -535,7 +557,7 @@ OIDC_PROVIDERS = { "response_type": "code", "scope": ["email", "profile:name", "phone"], "user_info_request": ["email", "first_name", "last_name", "phone"], - "acr_value": "http://idmanagement.gov/ns/assurance/ial/2", + "acr_value": "http://idmanagement.gov/ns/assurance/ial/1", }, "client_registration": { "client_id": ("urn:gov:cisa:openidconnect.profiles:sp:sso:cisa:dotgov_registrar"), diff --git a/src/registrar/config/urls.py b/src/registrar/config/urls.py index c00d1c589..6ded44913 100644 --- a/src/registrar/config/urls.py +++ b/src/registrar/config/urls.py @@ -11,7 +11,8 @@ from django.views.generic import RedirectView from registrar import views from registrar.views.application import Step from registrar.views.utility import always_404 -from api.views import available +from api.views import available, get_current_federal, get_current_full + APPLICATION_NAMESPACE = views.ApplicationWizard.URL_NAMESPACE application_urls = [ @@ -73,6 +74,8 @@ urlpatterns = [ path("openid/", include("djangooidc.urls")), path("register/", include((application_urls, APPLICATION_NAMESPACE))), path("api/v1/available/", available, name="available"), + path("api/v1/get-report/current-federal", get_current_federal, name="get-current-federal"), + path("api/v1/get-report/current-full", get_current_full, name="get-current-full"), path( "todo", lambda r: always_404(r, "We forgot to include this link, sorry."), diff --git a/src/registrar/forms/application_wizard.py b/src/registrar/forms/application_wizard.py index 03207087f..9a8899e2b 100644 --- a/src/registrar/forms/application_wizard.py +++ b/src/registrar/forms/application_wizard.py @@ -244,7 +244,7 @@ class OrganizationContactForm(RegistrarForm): ) address_line2 = forms.CharField( required=False, - label="Street address line 2", + label="Street address line 2 (optional)", ) city = forms.CharField( label="City", @@ -268,7 +268,7 @@ class OrganizationContactForm(RegistrarForm): ) urbanization = forms.CharField( required=False, - label="Urbanization (Puerto Rico only)", + label="Urbanization (required for Puerto Rico only)", ) def clean_federal_agency(self): @@ -331,7 +331,7 @@ class AuthorizingOfficialForm(RegistrarForm): ) middle_name = forms.CharField( required=False, - label="Middle name", + label="Middle name (optional)", ) last_name = forms.CharField( label="Last name / family name", @@ -407,7 +407,7 @@ class AlternativeDomainForm(RegistrarForm): alternative_domain = forms.CharField( required=False, - label="Alternative domain", + label="", ) @@ -533,7 +533,7 @@ class YourContactForm(RegistrarForm): ) middle_name = forms.CharField( required=False, - label="Middle name", + label="Middle name (optional)", ) last_name = forms.CharField( label="Last name / family name", @@ -562,7 +562,7 @@ class OtherContactsForm(RegistrarForm): ) middle_name = forms.CharField( required=False, - label="Middle name", + label="Middle name (optional)", ) last_name = forms.CharField( label="Last name / family name", @@ -614,8 +614,8 @@ class NoOtherContactsForm(RegistrarForm): required=True, # label has to end in a space to get the label_suffix to show label=( - "Please explain why there are no other employees from your organization" - " we can contact to help us assess your eligibility for a .gov domain." + "Please explain why there are no other employees from your organization " + "we can contact to help us assess your eligibility for a .gov domain." ), widget=forms.Textarea(), ) @@ -624,7 +624,7 @@ class NoOtherContactsForm(RegistrarForm): class AnythingElseForm(RegistrarForm): anything_else = forms.CharField( required=False, - label="Anything else we should know?", + label="Anything else?", widget=forms.Textarea(), validators=[ MaxLengthValidator( diff --git a/src/registrar/forms/domain.py b/src/registrar/forms/domain.py index 71c86ef41..ff41b9268 100644 --- a/src/registrar/forms/domain.py +++ b/src/registrar/forms/domain.py @@ -181,6 +181,9 @@ class ContactForm(forms.ModelForm): for field_name in self.required: self.fields[field_name].required = True + # Set custom form label + self.fields["middle_name"].label = "Middle name (optional)" + # Set custom error messages self.fields["first_name"].error_messages = {"required": "Enter your first name / given name."} self.fields["last_name"].error_messages = {"required": "Enter your last name / family name."} @@ -190,7 +193,7 @@ class ContactForm(forms.ModelForm): self.fields["email"].error_messages = { "required": "Enter your email address in the required format, like name@example.com." } - self.fields["phone"].error_messages = {"required": "Enter your phone number."} + self.fields["phone"].error_messages["required"] = "Enter your phone number." class AuthorizingOfficialContactForm(ContactForm): @@ -213,14 +216,14 @@ class AuthorizingOfficialContactForm(ContactForm): self.fields["email"].error_messages = { "required": "Enter an email address in the required format, like name@example.com." } - self.fields["phone"].error_messages = {"required": "Enter a phone number for your authorizing official."} + self.fields["phone"].error_messages["required"] = "Enter a phone number for your authorizing official." class DomainSecurityEmailForm(forms.Form): """Form for adding or editing a security email to a domain.""" security_email = forms.EmailField( - label="Security email", + label="Security email (optional)", required=False, error_messages={ "invalid": str(SecurityEmailError(code=SecurityEmailErrorCodes.BAD_DATA)), diff --git a/src/registrar/management/commands/generate_current_federal_report.py b/src/registrar/management/commands/generate_current_federal_report.py new file mode 100644 index 000000000..1a123bf5b --- /dev/null +++ b/src/registrar/management/commands/generate_current_federal_report.py @@ -0,0 +1,58 @@ +"""Generates current-full.csv and current-federal.csv then uploads them to the desired URL.""" +import logging +import os + +from django.core.management import BaseCommand +from registrar.utility import csv_export +from registrar.utility.s3_bucket import S3ClientHelper + + +logger = logging.getLogger(__name__) + + +class Command(BaseCommand): + help = ( + "Generates and uploads a current-federal.csv file to our S3 bucket " + "which is based off of all existing federal Domains." + ) + + def add_arguments(self, parser): + """Add our two filename arguments.""" + parser.add_argument("--directory", default="migrationdata", help="Desired directory") + parser.add_argument( + "--checkpath", + default=True, + help="Flag that determines if we do a check for os.path.exists. Used for test cases", + ) + + def handle(self, **options): + """Grabs the directory then creates current-federal.csv in that directory""" + file_name = "current-federal.csv" + # Ensures a slash is added + directory = os.path.join(options.get("directory"), "") + check_path = options.get("checkpath") + + logger.info("Generating report...") + try: + self.generate_current_federal_report(directory, file_name, check_path) + except Exception as err: + # TODO - #1317: Notify operations when auto report generation fails + raise err + else: + logger.info(f"Success! Created {file_name}") + + def generate_current_federal_report(self, directory, file_name, check_path): + """Creates a current-full.csv file under the specified directory, + then uploads it to a AWS S3 bucket""" + s3_client = S3ClientHelper() + file_path = os.path.join(directory, file_name) + + # Generate a file locally for upload + with open(file_path, "w") as file: + csv_export.export_data_federal_to_csv(file) + + if check_path and not os.path.exists(file_path): + raise FileNotFoundError(f"Could not find newly created file at '{file_path}'") + + # Upload this generated file for our S3 instance + s3_client.upload_file(file_path, file_name) diff --git a/src/registrar/management/commands/generate_current_full_report.py b/src/registrar/management/commands/generate_current_full_report.py new file mode 100644 index 000000000..80c031605 --- /dev/null +++ b/src/registrar/management/commands/generate_current_full_report.py @@ -0,0 +1,57 @@ +"""Generates current-full.csv and current-federal.csv then uploads them to the desired URL.""" +import logging +import os + +from django.core.management import BaseCommand +from registrar.utility import csv_export +from registrar.utility.s3_bucket import S3ClientHelper + + +logger = logging.getLogger(__name__) + + +class Command(BaseCommand): + help = ( + "Generates and uploads a current-full.csv file to our S3 bucket " "which is based off of all existing Domains." + ) + + def add_arguments(self, parser): + """Add our two filename arguments.""" + parser.add_argument("--directory", default="migrationdata", help="Desired directory") + parser.add_argument( + "--checkpath", + default=True, + help="Flag that determines if we do a check for os.path.exists. Used for test cases", + ) + + def handle(self, **options): + """Grabs the directory then creates current-full.csv in that directory""" + file_name = "current-full.csv" + # Ensures a slash is added + directory = os.path.join(options.get("directory"), "") + check_path = options.get("checkpath") + + logger.info("Generating report...") + try: + self.generate_current_full_report(directory, file_name, check_path) + except Exception as err: + # TODO - #1317: Notify operations when auto report generation fails + raise err + else: + logger.info(f"Success! Created {file_name}") + + def generate_current_full_report(self, directory, file_name, check_path): + """Creates a current-full.csv file under the specified directory, + then uploads it to a AWS S3 bucket""" + s3_client = S3ClientHelper() + file_path = os.path.join(directory, file_name) + + # Generate a file locally for upload + with open(file_path, "w") as file: + csv_export.export_data_full_to_csv(file) + + if check_path and not os.path.exists(file_path): + raise FileNotFoundError(f"Could not find newly created file at '{file_path}'") + + # Upload this generated file for our S3 instance + s3_client.upload_file(file_path, file_name) diff --git a/src/registrar/migrations/0049_alter_domainapplication_current_websites_and_more.py b/src/registrar/migrations/0049_alter_domainapplication_current_websites_and_more.py new file mode 100644 index 000000000..4341bdad6 --- /dev/null +++ b/src/registrar/migrations/0049_alter_domainapplication_current_websites_and_more.py @@ -0,0 +1,36 @@ +# Generated by Django 4.2.7 on 2023-12-05 10:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("registrar", "0048_alter_transitiondomain_status"), + ] + + operations = [ + migrations.AlterField( + model_name="domainapplication", + name="current_websites", + field=models.ManyToManyField( + blank=True, related_name="current+", to="registrar.website", verbose_name="websites" + ), + ), + migrations.AlterField( + model_name="domainapplication", + name="other_contacts", + field=models.ManyToManyField( + blank=True, related_name="contact_applications", to="registrar.contact", verbose_name="contacts" + ), + ), + migrations.AlterField( + model_name="domaininformation", + name="other_contacts", + field=models.ManyToManyField( + blank=True, + related_name="contact_applications_information", + to="registrar.contact", + verbose_name="contacts", + ), + ), + ] diff --git a/src/registrar/migrations/0050_alter_contact_middle_name_and_more.py b/src/registrar/migrations/0050_alter_contact_middle_name_and_more.py new file mode 100644 index 000000000..4009d17d9 --- /dev/null +++ b/src/registrar/migrations/0050_alter_contact_middle_name_and_more.py @@ -0,0 +1,37 @@ +# Generated by Django 4.2.7 on 2023-11-20 20:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("registrar", "0049_alter_domainapplication_current_websites_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="contact", + name="middle_name", + field=models.TextField(blank=True, help_text="Middle name (optional)", null=True), + ), + migrations.AlterField( + model_name="domainapplication", + name="address_line2", + field=models.TextField(blank=True, help_text="Street address line 2 (optional)", null=True), + ), + migrations.AlterField( + model_name="domaininformation", + name="address_line2", + field=models.TextField( + blank=True, + help_text="Street address line 2 (optional)", + null=True, + verbose_name="Street address line 2 (optional)", + ), + ), + migrations.AlterField( + model_name="transitiondomain", + name="middle_name", + field=models.TextField(blank=True, help_text="Middle name (optional)", null=True), + ), + ] diff --git a/src/registrar/migrations/0051_alter_domainapplication_urbanization_and_more.py b/src/registrar/migrations/0051_alter_domainapplication_urbanization_and_more.py new file mode 100644 index 000000000..9b012042d --- /dev/null +++ b/src/registrar/migrations/0051_alter_domainapplication_urbanization_and_more.py @@ -0,0 +1,27 @@ +# Generated by Django 4.2.7 on 2023-11-22 20:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("registrar", "0050_alter_contact_middle_name_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="domainapplication", + name="urbanization", + field=models.TextField(blank=True, help_text="Urbanization (required for Puerto Rico only)", null=True), + ), + migrations.AlterField( + model_name="domaininformation", + name="urbanization", + field=models.TextField( + blank=True, + help_text="Urbanization (required for Puerto Rico only)", + null=True, + verbose_name="Urbanization (required for Puerto Rico only)", + ), + ), + ] diff --git a/src/registrar/migrations/0052_alter_domainapplication_anything_else_and_more.py b/src/registrar/migrations/0052_alter_domainapplication_anything_else_and_more.py new file mode 100644 index 000000000..1d5607aad --- /dev/null +++ b/src/registrar/migrations/0052_alter_domainapplication_anything_else_and_more.py @@ -0,0 +1,22 @@ +# Generated by Django 4.2.7 on 2023-11-29 19:05 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("registrar", "0051_alter_domainapplication_urbanization_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="domainapplication", + name="anything_else", + field=models.TextField(blank=True, help_text="Anything else?", null=True), + ), + migrations.AlterField( + model_name="domaininformation", + name="anything_else", + field=models.TextField(blank=True, help_text="Anything else?", null=True), + ), + ] diff --git a/src/registrar/migrations/0053_create_groups_v05.py b/src/registrar/migrations/0053_create_groups_v05.py new file mode 100644 index 000000000..aaf74a9db --- /dev/null +++ b/src/registrar/migrations/0053_create_groups_v05.py @@ -0,0 +1,37 @@ +# This migration creates the create_full_access_group and create_cisa_analyst_group groups +# It is dependent on 0035 (which populates ContentType and Permissions) +# If permissions on the groups need changing, edit CISA_ANALYST_GROUP_PERMISSIONS +# in the user_group model then: +# [NOT RECOMMENDED] +# step 1: docker-compose exec app ./manage.py migrate --fake registrar 0035_contenttypes_permissions +# step 2: docker-compose exec app ./manage.py migrate registrar 0036_create_groups +# step 3: fake run the latest migration in the migrations list +# [RECOMMENDED] +# Alternatively: +# step 1: duplicate the migration that loads data +# step 2: docker-compose exec app ./manage.py migrate + +from django.db import migrations +from registrar.models import UserGroup +from typing import Any + + +# For linting: RunPython expects a function reference, +# so let's give it one +def create_groups(apps, schema_editor) -> Any: + UserGroup.create_cisa_analyst_group(apps, schema_editor) + UserGroup.create_full_access_group(apps, schema_editor) + + +class Migration(migrations.Migration): + dependencies = [ + ("registrar", "0052_alter_domainapplication_anything_else_and_more"), + ] + + operations = [ + migrations.RunPython( + create_groups, + reverse_code=migrations.RunPython.noop, + atomic=True, + ), + ] diff --git a/src/registrar/migrations/0054_alter_domainapplication_federal_agency_and_more.py b/src/registrar/migrations/0054_alter_domainapplication_federal_agency_and_more.py new file mode 100644 index 000000000..d16c9befd --- /dev/null +++ b/src/registrar/migrations/0054_alter_domainapplication_federal_agency_and_more.py @@ -0,0 +1,771 @@ +# Generated by Django 4.2.7 on 2023-11-29 22:32 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("registrar", "0053_create_groups_v05"), + ] + + operations = [ + migrations.AlterField( + model_name="domainapplication", + name="federal_agency", + field=models.TextField( + blank=True, + choices=[ + ( + "Administrative Conference of the United States", + "Administrative Conference of the United States", + ), + ("Advisory Council on Historic Preservation", "Advisory Council on Historic Preservation"), + ("American Battle Monuments Commission", "American Battle Monuments Commission"), + ("AMTRAK", "AMTRAK"), + ("Appalachian Regional Commission", "Appalachian Regional Commission"), + ( + "Appraisal Subcommittee of the Federal Financial Institutions Examination Council", + "Appraisal Subcommittee of the Federal Financial Institutions Examination Council", + ), + ("Appraisal Subcommittee", "Appraisal Subcommittee"), + ("Architect of the Capitol", "Architect of the Capitol"), + ("Armed Forces Retirement Home", "Armed Forces Retirement Home"), + ( + "Barry Goldwater Scholarship and Excellence in Education Foundation", + "Barry Goldwater Scholarship and Excellence in Education Foundation", + ), + ( + "Barry Goldwater Scholarship and Excellence in Education Program", + "Barry Goldwater Scholarship and Excellence in Education Program", + ), + ("Central Intelligence Agency", "Central Intelligence Agency"), + ("Chemical Safety Board", "Chemical Safety Board"), + ("Christopher Columbus Fellowship Foundation", "Christopher Columbus Fellowship Foundation"), + ("Civil Rights Cold Case Records Review Board", "Civil Rights Cold Case Records Review Board"), + ( + "Commission for the Preservation of America's Heritage Abroad", + "Commission for the Preservation of America's Heritage Abroad", + ), + ("Commission of Fine Arts", "Commission of Fine Arts"), + ( + "Committee for Purchase From People Who Are Blind or Severely Disabled", + "Committee for Purchase From People Who Are Blind or Severely Disabled", + ), + ("Commodity Futures Trading Commission", "Commodity Futures Trading Commission"), + ("Congressional Budget Office", "Congressional Budget Office"), + ("Consumer Financial Protection Bureau", "Consumer Financial Protection Bureau"), + ("Consumer Product Safety Commission", "Consumer Product Safety Commission"), + ("Corporation for National & Community Service", "Corporation for National & Community Service"), + ( + "Corporation for National and Community Service", + "Corporation for National and Community Service", + ), + ( + "Council of Inspectors General on Integrity and Efficiency", + "Council of Inspectors General on Integrity and Efficiency", + ), + ("Court Services and Offender Supervision", "Court Services and Offender Supervision"), + ("Cyberspace Solarium Commission", "Cyberspace Solarium Commission"), + ( + "DC Court Services and Offender Supervision Agency", + "DC Court Services and Offender Supervision Agency", + ), + ("DC Pre-trial Services", "DC Pre-trial Services"), + ("Defense Nuclear Facilities Safety Board", "Defense Nuclear Facilities Safety Board"), + ("Delta Regional Authority", "Delta Regional Authority"), + ("Denali Commission", "Denali Commission"), + ("Department of Agriculture", "Department of Agriculture"), + ("Department of Commerce", "Department of Commerce"), + ("Department of Defense", "Department of Defense"), + ("Department of Education", "Department of Education"), + ("Department of Energy", "Department of Energy"), + ("Department of Health and Human Services", "Department of Health and Human Services"), + ("Department of Homeland Security", "Department of Homeland Security"), + ("Department of Housing and Urban Development", "Department of Housing and Urban Development"), + ("Department of Justice", "Department of Justice"), + ("Department of Labor", "Department of Labor"), + ("Department of State", "Department of State"), + ("Department of the Interior", "Department of the Interior"), + ("Department of the Treasury", "Department of the Treasury"), + ("Department of Transportation", "Department of Transportation"), + ("Department of Veterans Affairs", "Department of Veterans Affairs"), + ("Director of National Intelligence", "Director of National Intelligence"), + ("Dwight D. Eisenhower Memorial Commission", "Dwight D. Eisenhower Memorial Commission"), + ("Election Assistance Commission", "Election Assistance Commission"), + ("Environmental Protection Agency", "Environmental Protection Agency"), + ("Equal Employment Opportunity Commission", "Equal Employment Opportunity Commission"), + ("Executive Office of the President", "Executive Office of the President"), + ("Export-Import Bank of the United States", "Export-Import Bank of the United States"), + ("Export/Import Bank of the U.S.", "Export/Import Bank of the U.S."), + ("Farm Credit Administration", "Farm Credit Administration"), + ("Farm Credit System Insurance Corporation", "Farm Credit System Insurance Corporation"), + ("Federal Communications Commission", "Federal Communications Commission"), + ("Federal Deposit Insurance Corporation", "Federal Deposit Insurance Corporation"), + ("Federal Election Commission", "Federal Election Commission"), + ("Federal Energy Regulatory Commission", "Federal Energy Regulatory Commission"), + ( + "Federal Financial Institutions Examination Council", + "Federal Financial Institutions Examination Council", + ), + ("Federal Housing Finance Agency", "Federal Housing Finance Agency"), + ("Federal Judiciary", "Federal Judiciary"), + ("Federal Labor Relations Authority", "Federal Labor Relations Authority"), + ("Federal Maritime Commission", "Federal Maritime Commission"), + ("Federal Mediation and Conciliation Service", "Federal Mediation and Conciliation Service"), + ( + "Federal Mine Safety and Health Review Commission", + "Federal Mine Safety and Health Review Commission", + ), + ( + "Federal Permitting Improvement Steering Council", + "Federal Permitting Improvement Steering Council", + ), + ("Federal Reserve Board of Governors", "Federal Reserve Board of Governors"), + ("Federal Reserve System", "Federal Reserve System"), + ("Federal Trade Commission", "Federal Trade Commission"), + ("General Services Administration", "General Services Administration"), + ("gov Administration", "gov Administration"), + ("Government Accountability Office", "Government Accountability Office"), + ("Government Publishing Office", "Government Publishing Office"), + ("Gulf Coast Ecosystem Restoration Council", "Gulf Coast Ecosystem Restoration Council"), + ("Harry S Truman Scholarship Foundation", "Harry S Truman Scholarship Foundation"), + ("Harry S. Truman Scholarship Foundation", "Harry S. Truman Scholarship Foundation"), + ("Institute of Museum and Library Services", "Institute of Museum and Library Services"), + ("Institute of Peace", "Institute of Peace"), + ("Inter-American Foundation", "Inter-American Foundation"), + ( + "International Boundary and Water Commission: United States and Mexico", + "International Boundary and Water Commission: United States and Mexico", + ), + ( + "International Boundary Commission: United States and Canada", + "International Boundary Commission: United States and Canada", + ), + ( + "International Joint Commission: United States and Canada", + "International Joint Commission: United States and Canada", + ), + ("James Madison Memorial Fellowship Foundation", "James Madison Memorial Fellowship Foundation"), + ("Japan-United States Friendship Commission", "Japan-United States Friendship Commission"), + ("Japan-US Friendship Commission", "Japan-US Friendship Commission"), + ("John F. Kennedy Center for Performing Arts", "John F. Kennedy Center for Performing Arts"), + ( + "John F. Kennedy Center for the Performing Arts", + "John F. Kennedy Center for the Performing Arts", + ), + ("Legal Services Corporation", "Legal Services Corporation"), + ("Legislative Branch", "Legislative Branch"), + ("Library of Congress", "Library of Congress"), + ("Marine Mammal Commission", "Marine Mammal Commission"), + ( + "Medicaid and CHIP Payment and Access Commission", + "Medicaid and CHIP Payment and Access Commission", + ), + ("Medical Payment Advisory Commission", "Medical Payment Advisory Commission"), + ("Medicare Payment Advisory Commission", "Medicare Payment Advisory Commission"), + ("Merit Systems Protection Board", "Merit Systems Protection Board"), + ("Millennium Challenge Corporation", "Millennium Challenge Corporation"), + ( + "Morris K. Udall and Stewart L. Udall Foundation", + "Morris K. Udall and Stewart L. Udall Foundation", + ), + ("National Aeronautics and Space Administration", "National Aeronautics and Space Administration"), + ("National Archives and Records Administration", "National Archives and Records Administration"), + ("National Capital Planning Commission", "National Capital Planning Commission"), + ("National Council on Disability", "National Council on Disability"), + ("National Credit Union Administration", "National Credit Union Administration"), + ("National Endowment for the Arts", "National Endowment for the Arts"), + ("National Endowment for the Humanities", "National Endowment for the Humanities"), + ( + "National Foundation on the Arts and the Humanities", + "National Foundation on the Arts and the Humanities", + ), + ("National Gallery of Art", "National Gallery of Art"), + ("National Indian Gaming Commission", "National Indian Gaming Commission"), + ("National Labor Relations Board", "National Labor Relations Board"), + ("National Mediation Board", "National Mediation Board"), + ("National Science Foundation", "National Science Foundation"), + ( + "National Security Commission on Artificial Intelligence", + "National Security Commission on Artificial Intelligence", + ), + ("National Transportation Safety Board", "National Transportation Safety Board"), + ( + "Networking Information Technology Research and Development", + "Networking Information Technology Research and Development", + ), + ("Non-Federal Agency", "Non-Federal Agency"), + ("Northern Border Regional Commission", "Northern Border Regional Commission"), + ("Nuclear Regulatory Commission", "Nuclear Regulatory Commission"), + ("Nuclear Safety Oversight Committee", "Nuclear Safety Oversight Committee"), + ("Nuclear Waste Technical Review Board", "Nuclear Waste Technical Review Board"), + ( + "Occupational Safety & Health Review Commission", + "Occupational Safety & Health Review Commission", + ), + ( + "Occupational Safety and Health Review Commission", + "Occupational Safety and Health Review Commission", + ), + ("Office of Compliance", "Office of Compliance"), + ("Office of Congressional Workplace Rights", "Office of Congressional Workplace Rights"), + ("Office of Government Ethics", "Office of Government Ethics"), + ("Office of Navajo and Hopi Indian Relocation", "Office of Navajo and Hopi Indian Relocation"), + ("Office of Personnel Management", "Office of Personnel Management"), + ("Open World Leadership Center", "Open World Leadership Center"), + ("Overseas Private Investment Corporation", "Overseas Private Investment Corporation"), + ("Peace Corps", "Peace Corps"), + ("Pension Benefit Guaranty Corporation", "Pension Benefit Guaranty Corporation"), + ("Postal Regulatory Commission", "Postal Regulatory Commission"), + ("Presidio Trust", "Presidio Trust"), + ("Privacy and Civil Liberties Oversight Board", "Privacy and Civil Liberties Oversight Board"), + ("Public Buildings Reform Board", "Public Buildings Reform Board"), + ( + "Public Defender Service for the District of Columbia", + "Public Defender Service for the District of Columbia", + ), + ("Railroad Retirement Board", "Railroad Retirement Board"), + ("Securities and Exchange Commission", "Securities and Exchange Commission"), + ("Selective Service System", "Selective Service System"), + ("Small Business Administration", "Small Business Administration"), + ("Smithsonian Institution", "Smithsonian Institution"), + ("Social Security Administration", "Social Security Administration"), + ("Social Security Advisory Board", "Social Security Advisory Board"), + ("Southeast Crescent Regional Commission", "Southeast Crescent Regional Commission"), + ("Southwest Border Regional Commission", "Southwest Border Regional Commission"), + ("State Justice Institute", "State Justice Institute"), + ("State, Local, and Tribal Government", "State, Local, and Tribal Government"), + ("Stennis Center for Public Service", "Stennis Center for Public Service"), + ("Surface Transportation Board", "Surface Transportation Board"), + ("Tennessee Valley Authority", "Tennessee Valley Authority"), + ("The Executive Office of the President", "The Executive Office of the President"), + ("The Intelligence Community", "The Intelligence Community"), + ("The Legislative Branch", "The Legislative Branch"), + ("The Supreme Court", "The Supreme Court"), + ( + "The United States World War One Centennial Commission", + "The United States World War One Centennial Commission", + ), + ("U.S. Access Board", "U.S. Access Board"), + ("U.S. Agency for Global Media", "U.S. Agency for Global Media"), + ("U.S. Agency for International Development", "U.S. Agency for International Development"), + ("U.S. Capitol Police", "U.S. Capitol Police"), + ("U.S. Chemical Safety Board", "U.S. Chemical Safety Board"), + ( + "U.S. China Economic and Security Review Commission", + "U.S. China Economic and Security Review Commission", + ), + ( + "U.S. Commission for the Preservation of Americas Heritage Abroad", + "U.S. Commission for the Preservation of Americas Heritage Abroad", + ), + ("U.S. Commission of Fine Arts", "U.S. Commission of Fine Arts"), + ("U.S. Commission on Civil Rights", "U.S. Commission on Civil Rights"), + ( + "U.S. Commission on International Religious Freedom", + "U.S. Commission on International Religious Freedom", + ), + ("U.S. Courts", "U.S. Courts"), + ("U.S. Department of Agriculture", "U.S. Department of Agriculture"), + ("U.S. Interagency Council on Homelessness", "U.S. Interagency Council on Homelessness"), + ("U.S. International Trade Commission", "U.S. International Trade Commission"), + ("U.S. Nuclear Waste Technical Review Board", "U.S. Nuclear Waste Technical Review Board"), + ("U.S. Office of Special Counsel", "U.S. Office of Special Counsel"), + ("U.S. Peace Corps", "U.S. Peace Corps"), + ("U.S. Postal Service", "U.S. Postal Service"), + ("U.S. Semiquincentennial Commission", "U.S. Semiquincentennial Commission"), + ("U.S. Trade and Development Agency", "U.S. Trade and Development Agency"), + ( + "U.S.-China Economic and Security Review Commission", + "U.S.-China Economic and Security Review Commission", + ), + ("Udall Foundation", "Udall Foundation"), + ("United States AbilityOne", "United States AbilityOne"), + ("United States Access Board", "United States Access Board"), + ("United States African Development Foundation", "United States African Development Foundation"), + ("United States Agency for Global Media", "United States Agency for Global Media"), + ("United States Arctic Research Commission", "United States Arctic Research Commission"), + ("United States Global Change Research Program", "United States Global Change Research Program"), + ("United States Holocaust Memorial Museum", "United States Holocaust Memorial Museum"), + ("United States Institute of Peace", "United States Institute of Peace"), + ( + "United States Interagency Council on Homelessness", + "United States Interagency Council on Homelessness", + ), + ( + "United States International Development Finance Corporation", + "United States International Development Finance Corporation", + ), + ("United States International Trade Commission", "United States International Trade Commission"), + ("United States Postal Service", "United States Postal Service"), + ("United States Senate", "United States Senate"), + ("United States Trade and Development Agency", "United States Trade and Development Agency"), + ( + "Utah Reclamation Mitigation and Conservation Commission", + "Utah Reclamation Mitigation and Conservation Commission", + ), + ("Vietnam Education Foundation", "Vietnam Education Foundation"), + ("Western Hemisphere Drug Policy Commission", "Western Hemisphere Drug Policy Commission"), + ( + "Woodrow Wilson International Center for Scholars", + "Woodrow Wilson International Center for Scholars", + ), + ("World War I Centennial Commission", "World War I Centennial Commission"), + ], + help_text="Federal agency", + null=True, + ), + ), + migrations.AlterField( + model_name="domainapplication", + name="state_territory", + field=models.CharField( + blank=True, + choices=[ + ("AL", "Alabama (AL)"), + ("AK", "Alaska (AK)"), + ("AS", "American Samoa (AS)"), + ("AZ", "Arizona (AZ)"), + ("AR", "Arkansas (AR)"), + ("CA", "California (CA)"), + ("CO", "Colorado (CO)"), + ("CT", "Connecticut (CT)"), + ("DE", "Delaware (DE)"), + ("DC", "District of Columbia (DC)"), + ("FL", "Florida (FL)"), + ("GA", "Georgia (GA)"), + ("GU", "Guam (GU)"), + ("HI", "Hawaii (HI)"), + ("ID", "Idaho (ID)"), + ("IL", "Illinois (IL)"), + ("IN", "Indiana (IN)"), + ("IA", "Iowa (IA)"), + ("KS", "Kansas (KS)"), + ("KY", "Kentucky (KY)"), + ("LA", "Louisiana (LA)"), + ("ME", "Maine (ME)"), + ("MD", "Maryland (MD)"), + ("MA", "Massachusetts (MA)"), + ("MI", "Michigan (MI)"), + ("MN", "Minnesota (MN)"), + ("MS", "Mississippi (MS)"), + ("MO", "Missouri (MO)"), + ("MT", "Montana (MT)"), + ("NE", "Nebraska (NE)"), + ("NV", "Nevada (NV)"), + ("NH", "New Hampshire (NH)"), + ("NJ", "New Jersey (NJ)"), + ("NM", "New Mexico (NM)"), + ("NY", "New York (NY)"), + ("NC", "North Carolina (NC)"), + ("ND", "North Dakota (ND)"), + ("MP", "Northern Mariana Islands (MP)"), + ("OH", "Ohio (OH)"), + ("OK", "Oklahoma (OK)"), + ("OR", "Oregon (OR)"), + ("PA", "Pennsylvania (PA)"), + ("PR", "Puerto Rico (PR)"), + ("RI", "Rhode Island (RI)"), + ("SC", "South Carolina (SC)"), + ("SD", "South Dakota (SD)"), + ("TN", "Tennessee (TN)"), + ("TX", "Texas (TX)"), + ("UM", "United States Minor Outlying Islands (UM)"), + ("UT", "Utah (UT)"), + ("VT", "Vermont (VT)"), + ("VI", "Virgin Islands (VI)"), + ("VA", "Virginia (VA)"), + ("WA", "Washington (WA)"), + ("WV", "West Virginia (WV)"), + ("WI", "Wisconsin (WI)"), + ("WY", "Wyoming (WY)"), + ("AA", "Armed Forces Americas (AA)"), + ("AE", "Armed Forces Africa, Canada, Europe, Middle East (AE)"), + ("AP", "Armed Forces Pacific (AP)"), + ], + help_text="State, territory, or military post", + max_length=2, + null=True, + ), + ), + migrations.AlterField( + model_name="domaininformation", + name="federal_agency", + field=models.TextField( + blank=True, + choices=[ + ( + "Administrative Conference of the United States", + "Administrative Conference of the United States", + ), + ("Advisory Council on Historic Preservation", "Advisory Council on Historic Preservation"), + ("American Battle Monuments Commission", "American Battle Monuments Commission"), + ("AMTRAK", "AMTRAK"), + ("Appalachian Regional Commission", "Appalachian Regional Commission"), + ( + "Appraisal Subcommittee of the Federal Financial Institutions Examination Council", + "Appraisal Subcommittee of the Federal Financial Institutions Examination Council", + ), + ("Appraisal Subcommittee", "Appraisal Subcommittee"), + ("Architect of the Capitol", "Architect of the Capitol"), + ("Armed Forces Retirement Home", "Armed Forces Retirement Home"), + ( + "Barry Goldwater Scholarship and Excellence in Education Foundation", + "Barry Goldwater Scholarship and Excellence in Education Foundation", + ), + ( + "Barry Goldwater Scholarship and Excellence in Education Program", + "Barry Goldwater Scholarship and Excellence in Education Program", + ), + ("Central Intelligence Agency", "Central Intelligence Agency"), + ("Chemical Safety Board", "Chemical Safety Board"), + ("Christopher Columbus Fellowship Foundation", "Christopher Columbus Fellowship Foundation"), + ("Civil Rights Cold Case Records Review Board", "Civil Rights Cold Case Records Review Board"), + ( + "Commission for the Preservation of America's Heritage Abroad", + "Commission for the Preservation of America's Heritage Abroad", + ), + ("Commission of Fine Arts", "Commission of Fine Arts"), + ( + "Committee for Purchase From People Who Are Blind or Severely Disabled", + "Committee for Purchase From People Who Are Blind or Severely Disabled", + ), + ("Commodity Futures Trading Commission", "Commodity Futures Trading Commission"), + ("Congressional Budget Office", "Congressional Budget Office"), + ("Consumer Financial Protection Bureau", "Consumer Financial Protection Bureau"), + ("Consumer Product Safety Commission", "Consumer Product Safety Commission"), + ("Corporation for National & Community Service", "Corporation for National & Community Service"), + ( + "Corporation for National and Community Service", + "Corporation for National and Community Service", + ), + ( + "Council of Inspectors General on Integrity and Efficiency", + "Council of Inspectors General on Integrity and Efficiency", + ), + ("Court Services and Offender Supervision", "Court Services and Offender Supervision"), + ("Cyberspace Solarium Commission", "Cyberspace Solarium Commission"), + ( + "DC Court Services and Offender Supervision Agency", + "DC Court Services and Offender Supervision Agency", + ), + ("DC Pre-trial Services", "DC Pre-trial Services"), + ("Defense Nuclear Facilities Safety Board", "Defense Nuclear Facilities Safety Board"), + ("Delta Regional Authority", "Delta Regional Authority"), + ("Denali Commission", "Denali Commission"), + ("Department of Agriculture", "Department of Agriculture"), + ("Department of Commerce", "Department of Commerce"), + ("Department of Defense", "Department of Defense"), + ("Department of Education", "Department of Education"), + ("Department of Energy", "Department of Energy"), + ("Department of Health and Human Services", "Department of Health and Human Services"), + ("Department of Homeland Security", "Department of Homeland Security"), + ("Department of Housing and Urban Development", "Department of Housing and Urban Development"), + ("Department of Justice", "Department of Justice"), + ("Department of Labor", "Department of Labor"), + ("Department of State", "Department of State"), + ("Department of the Interior", "Department of the Interior"), + ("Department of the Treasury", "Department of the Treasury"), + ("Department of Transportation", "Department of Transportation"), + ("Department of Veterans Affairs", "Department of Veterans Affairs"), + ("Director of National Intelligence", "Director of National Intelligence"), + ("Dwight D. Eisenhower Memorial Commission", "Dwight D. Eisenhower Memorial Commission"), + ("Election Assistance Commission", "Election Assistance Commission"), + ("Environmental Protection Agency", "Environmental Protection Agency"), + ("Equal Employment Opportunity Commission", "Equal Employment Opportunity Commission"), + ("Executive Office of the President", "Executive Office of the President"), + ("Export-Import Bank of the United States", "Export-Import Bank of the United States"), + ("Export/Import Bank of the U.S.", "Export/Import Bank of the U.S."), + ("Farm Credit Administration", "Farm Credit Administration"), + ("Farm Credit System Insurance Corporation", "Farm Credit System Insurance Corporation"), + ("Federal Communications Commission", "Federal Communications Commission"), + ("Federal Deposit Insurance Corporation", "Federal Deposit Insurance Corporation"), + ("Federal Election Commission", "Federal Election Commission"), + ("Federal Energy Regulatory Commission", "Federal Energy Regulatory Commission"), + ( + "Federal Financial Institutions Examination Council", + "Federal Financial Institutions Examination Council", + ), + ("Federal Housing Finance Agency", "Federal Housing Finance Agency"), + ("Federal Judiciary", "Federal Judiciary"), + ("Federal Labor Relations Authority", "Federal Labor Relations Authority"), + ("Federal Maritime Commission", "Federal Maritime Commission"), + ("Federal Mediation and Conciliation Service", "Federal Mediation and Conciliation Service"), + ( + "Federal Mine Safety and Health Review Commission", + "Federal Mine Safety and Health Review Commission", + ), + ( + "Federal Permitting Improvement Steering Council", + "Federal Permitting Improvement Steering Council", + ), + ("Federal Reserve Board of Governors", "Federal Reserve Board of Governors"), + ("Federal Reserve System", "Federal Reserve System"), + ("Federal Trade Commission", "Federal Trade Commission"), + ("General Services Administration", "General Services Administration"), + ("gov Administration", "gov Administration"), + ("Government Accountability Office", "Government Accountability Office"), + ("Government Publishing Office", "Government Publishing Office"), + ("Gulf Coast Ecosystem Restoration Council", "Gulf Coast Ecosystem Restoration Council"), + ("Harry S Truman Scholarship Foundation", "Harry S Truman Scholarship Foundation"), + ("Harry S. Truman Scholarship Foundation", "Harry S. Truman Scholarship Foundation"), + ("Institute of Museum and Library Services", "Institute of Museum and Library Services"), + ("Institute of Peace", "Institute of Peace"), + ("Inter-American Foundation", "Inter-American Foundation"), + ( + "International Boundary and Water Commission: United States and Mexico", + "International Boundary and Water Commission: United States and Mexico", + ), + ( + "International Boundary Commission: United States and Canada", + "International Boundary Commission: United States and Canada", + ), + ( + "International Joint Commission: United States and Canada", + "International Joint Commission: United States and Canada", + ), + ("James Madison Memorial Fellowship Foundation", "James Madison Memorial Fellowship Foundation"), + ("Japan-United States Friendship Commission", "Japan-United States Friendship Commission"), + ("Japan-US Friendship Commission", "Japan-US Friendship Commission"), + ("John F. Kennedy Center for Performing Arts", "John F. Kennedy Center for Performing Arts"), + ( + "John F. Kennedy Center for the Performing Arts", + "John F. Kennedy Center for the Performing Arts", + ), + ("Legal Services Corporation", "Legal Services Corporation"), + ("Legislative Branch", "Legislative Branch"), + ("Library of Congress", "Library of Congress"), + ("Marine Mammal Commission", "Marine Mammal Commission"), + ( + "Medicaid and CHIP Payment and Access Commission", + "Medicaid and CHIP Payment and Access Commission", + ), + ("Medical Payment Advisory Commission", "Medical Payment Advisory Commission"), + ("Medicare Payment Advisory Commission", "Medicare Payment Advisory Commission"), + ("Merit Systems Protection Board", "Merit Systems Protection Board"), + ("Millennium Challenge Corporation", "Millennium Challenge Corporation"), + ( + "Morris K. Udall and Stewart L. Udall Foundation", + "Morris K. Udall and Stewart L. Udall Foundation", + ), + ("National Aeronautics and Space Administration", "National Aeronautics and Space Administration"), + ("National Archives and Records Administration", "National Archives and Records Administration"), + ("National Capital Planning Commission", "National Capital Planning Commission"), + ("National Council on Disability", "National Council on Disability"), + ("National Credit Union Administration", "National Credit Union Administration"), + ("National Endowment for the Arts", "National Endowment for the Arts"), + ("National Endowment for the Humanities", "National Endowment for the Humanities"), + ( + "National Foundation on the Arts and the Humanities", + "National Foundation on the Arts and the Humanities", + ), + ("National Gallery of Art", "National Gallery of Art"), + ("National Indian Gaming Commission", "National Indian Gaming Commission"), + ("National Labor Relations Board", "National Labor Relations Board"), + ("National Mediation Board", "National Mediation Board"), + ("National Science Foundation", "National Science Foundation"), + ( + "National Security Commission on Artificial Intelligence", + "National Security Commission on Artificial Intelligence", + ), + ("National Transportation Safety Board", "National Transportation Safety Board"), + ( + "Networking Information Technology Research and Development", + "Networking Information Technology Research and Development", + ), + ("Non-Federal Agency", "Non-Federal Agency"), + ("Northern Border Regional Commission", "Northern Border Regional Commission"), + ("Nuclear Regulatory Commission", "Nuclear Regulatory Commission"), + ("Nuclear Safety Oversight Committee", "Nuclear Safety Oversight Committee"), + ("Nuclear Waste Technical Review Board", "Nuclear Waste Technical Review Board"), + ( + "Occupational Safety & Health Review Commission", + "Occupational Safety & Health Review Commission", + ), + ( + "Occupational Safety and Health Review Commission", + "Occupational Safety and Health Review Commission", + ), + ("Office of Compliance", "Office of Compliance"), + ("Office of Congressional Workplace Rights", "Office of Congressional Workplace Rights"), + ("Office of Government Ethics", "Office of Government Ethics"), + ("Office of Navajo and Hopi Indian Relocation", "Office of Navajo and Hopi Indian Relocation"), + ("Office of Personnel Management", "Office of Personnel Management"), + ("Open World Leadership Center", "Open World Leadership Center"), + ("Overseas Private Investment Corporation", "Overseas Private Investment Corporation"), + ("Peace Corps", "Peace Corps"), + ("Pension Benefit Guaranty Corporation", "Pension Benefit Guaranty Corporation"), + ("Postal Regulatory Commission", "Postal Regulatory Commission"), + ("Presidio Trust", "Presidio Trust"), + ("Privacy and Civil Liberties Oversight Board", "Privacy and Civil Liberties Oversight Board"), + ("Public Buildings Reform Board", "Public Buildings Reform Board"), + ( + "Public Defender Service for the District of Columbia", + "Public Defender Service for the District of Columbia", + ), + ("Railroad Retirement Board", "Railroad Retirement Board"), + ("Securities and Exchange Commission", "Securities and Exchange Commission"), + ("Selective Service System", "Selective Service System"), + ("Small Business Administration", "Small Business Administration"), + ("Smithsonian Institution", "Smithsonian Institution"), + ("Social Security Administration", "Social Security Administration"), + ("Social Security Advisory Board", "Social Security Advisory Board"), + ("Southeast Crescent Regional Commission", "Southeast Crescent Regional Commission"), + ("Southwest Border Regional Commission", "Southwest Border Regional Commission"), + ("State Justice Institute", "State Justice Institute"), + ("State, Local, and Tribal Government", "State, Local, and Tribal Government"), + ("Stennis Center for Public Service", "Stennis Center for Public Service"), + ("Surface Transportation Board", "Surface Transportation Board"), + ("Tennessee Valley Authority", "Tennessee Valley Authority"), + ("The Executive Office of the President", "The Executive Office of the President"), + ("The Intelligence Community", "The Intelligence Community"), + ("The Legislative Branch", "The Legislative Branch"), + ("The Supreme Court", "The Supreme Court"), + ( + "The United States World War One Centennial Commission", + "The United States World War One Centennial Commission", + ), + ("U.S. Access Board", "U.S. Access Board"), + ("U.S. Agency for Global Media", "U.S. Agency for Global Media"), + ("U.S. Agency for International Development", "U.S. Agency for International Development"), + ("U.S. Capitol Police", "U.S. Capitol Police"), + ("U.S. Chemical Safety Board", "U.S. Chemical Safety Board"), + ( + "U.S. China Economic and Security Review Commission", + "U.S. China Economic and Security Review Commission", + ), + ( + "U.S. Commission for the Preservation of Americas Heritage Abroad", + "U.S. Commission for the Preservation of Americas Heritage Abroad", + ), + ("U.S. Commission of Fine Arts", "U.S. Commission of Fine Arts"), + ("U.S. Commission on Civil Rights", "U.S. Commission on Civil Rights"), + ( + "U.S. Commission on International Religious Freedom", + "U.S. Commission on International Religious Freedom", + ), + ("U.S. Courts", "U.S. Courts"), + ("U.S. Department of Agriculture", "U.S. Department of Agriculture"), + ("U.S. Interagency Council on Homelessness", "U.S. Interagency Council on Homelessness"), + ("U.S. International Trade Commission", "U.S. International Trade Commission"), + ("U.S. Nuclear Waste Technical Review Board", "U.S. Nuclear Waste Technical Review Board"), + ("U.S. Office of Special Counsel", "U.S. Office of Special Counsel"), + ("U.S. Peace Corps", "U.S. Peace Corps"), + ("U.S. Postal Service", "U.S. Postal Service"), + ("U.S. Semiquincentennial Commission", "U.S. Semiquincentennial Commission"), + ("U.S. Trade and Development Agency", "U.S. Trade and Development Agency"), + ( + "U.S.-China Economic and Security Review Commission", + "U.S.-China Economic and Security Review Commission", + ), + ("Udall Foundation", "Udall Foundation"), + ("United States AbilityOne", "United States AbilityOne"), + ("United States Access Board", "United States Access Board"), + ("United States African Development Foundation", "United States African Development Foundation"), + ("United States Agency for Global Media", "United States Agency for Global Media"), + ("United States Arctic Research Commission", "United States Arctic Research Commission"), + ("United States Global Change Research Program", "United States Global Change Research Program"), + ("United States Holocaust Memorial Museum", "United States Holocaust Memorial Museum"), + ("United States Institute of Peace", "United States Institute of Peace"), + ( + "United States Interagency Council on Homelessness", + "United States Interagency Council on Homelessness", + ), + ( + "United States International Development Finance Corporation", + "United States International Development Finance Corporation", + ), + ("United States International Trade Commission", "United States International Trade Commission"), + ("United States Postal Service", "United States Postal Service"), + ("United States Senate", "United States Senate"), + ("United States Trade and Development Agency", "United States Trade and Development Agency"), + ( + "Utah Reclamation Mitigation and Conservation Commission", + "Utah Reclamation Mitigation and Conservation Commission", + ), + ("Vietnam Education Foundation", "Vietnam Education Foundation"), + ("Western Hemisphere Drug Policy Commission", "Western Hemisphere Drug Policy Commission"), + ( + "Woodrow Wilson International Center for Scholars", + "Woodrow Wilson International Center for Scholars", + ), + ("World War I Centennial Commission", "World War I Centennial Commission"), + ], + help_text="Federal agency", + null=True, + ), + ), + migrations.AlterField( + model_name="domaininformation", + name="state_territory", + field=models.CharField( + blank=True, + choices=[ + ("AL", "Alabama (AL)"), + ("AK", "Alaska (AK)"), + ("AS", "American Samoa (AS)"), + ("AZ", "Arizona (AZ)"), + ("AR", "Arkansas (AR)"), + ("CA", "California (CA)"), + ("CO", "Colorado (CO)"), + ("CT", "Connecticut (CT)"), + ("DE", "Delaware (DE)"), + ("DC", "District of Columbia (DC)"), + ("FL", "Florida (FL)"), + ("GA", "Georgia (GA)"), + ("GU", "Guam (GU)"), + ("HI", "Hawaii (HI)"), + ("ID", "Idaho (ID)"), + ("IL", "Illinois (IL)"), + ("IN", "Indiana (IN)"), + ("IA", "Iowa (IA)"), + ("KS", "Kansas (KS)"), + ("KY", "Kentucky (KY)"), + ("LA", "Louisiana (LA)"), + ("ME", "Maine (ME)"), + ("MD", "Maryland (MD)"), + ("MA", "Massachusetts (MA)"), + ("MI", "Michigan (MI)"), + ("MN", "Minnesota (MN)"), + ("MS", "Mississippi (MS)"), + ("MO", "Missouri (MO)"), + ("MT", "Montana (MT)"), + ("NE", "Nebraska (NE)"), + ("NV", "Nevada (NV)"), + ("NH", "New Hampshire (NH)"), + ("NJ", "New Jersey (NJ)"), + ("NM", "New Mexico (NM)"), + ("NY", "New York (NY)"), + ("NC", "North Carolina (NC)"), + ("ND", "North Dakota (ND)"), + ("MP", "Northern Mariana Islands (MP)"), + ("OH", "Ohio (OH)"), + ("OK", "Oklahoma (OK)"), + ("OR", "Oregon (OR)"), + ("PA", "Pennsylvania (PA)"), + ("PR", "Puerto Rico (PR)"), + ("RI", "Rhode Island (RI)"), + ("SC", "South Carolina (SC)"), + ("SD", "South Dakota (SD)"), + ("TN", "Tennessee (TN)"), + ("TX", "Texas (TX)"), + ("UM", "United States Minor Outlying Islands (UM)"), + ("UT", "Utah (UT)"), + ("VT", "Vermont (VT)"), + ("VI", "Virgin Islands (VI)"), + ("VA", "Virginia (VA)"), + ("WA", "Washington (WA)"), + ("WV", "West Virginia (WV)"), + ("WI", "Wisconsin (WI)"), + ("WY", "Wyoming (WY)"), + ("AA", "Armed Forces Americas (AA)"), + ("AE", "Armed Forces Africa, Canada, Europe, Middle East (AE)"), + ("AP", "Armed Forces Pacific (AP)"), + ], + help_text="State, territory, or military post", + max_length=2, + null=True, + verbose_name="State, territory, or military post", + ), + ), + ] diff --git a/src/registrar/models/__init__.py b/src/registrar/models/__init__.py index 1d28c9e89..1203c7878 100644 --- a/src/registrar/models/__init__.py +++ b/src/registrar/models/__init__.py @@ -38,6 +38,7 @@ auditlog.register(DomainApplication) auditlog.register(Domain) auditlog.register(DraftDomain) auditlog.register(DomainInvitation) +auditlog.register(DomainInformation) auditlog.register(HostIP) auditlog.register(Host) auditlog.register(Nameserver) diff --git a/src/registrar/models/contact.py b/src/registrar/models/contact.py index 41ed9f2c5..0a7ba4fa1 100644 --- a/src/registrar/models/contact.py +++ b/src/registrar/models/contact.py @@ -26,7 +26,7 @@ class Contact(TimeStampedModel): middle_name = models.TextField( null=True, blank=True, - help_text="Middle name", + help_text="Middle name (optional)", ) last_name = models.TextField( null=True, diff --git a/src/registrar/models/domain_application.py b/src/registrar/models/domain_application.py index 86b8a0f7a..2eb2075b7 100644 --- a/src/registrar/models/domain_application.py +++ b/src/registrar/models/domain_application.py @@ -409,6 +409,7 @@ class DomainApplication(TimeStampedModel): ) federal_agency = models.TextField( + choices=AGENCY_CHOICES, null=True, blank=True, help_text="Federal agency", @@ -442,7 +443,7 @@ class DomainApplication(TimeStampedModel): address_line2 = models.TextField( null=True, blank=True, - help_text="Street address line 2", + help_text="Street address line 2 (optional)", ) city = models.TextField( null=True, @@ -451,6 +452,7 @@ class DomainApplication(TimeStampedModel): ) state_territory = models.CharField( max_length=2, + choices=StateTerritoryChoices.choices, null=True, blank=True, help_text="State, territory, or military post", @@ -465,7 +467,7 @@ class DomainApplication(TimeStampedModel): urbanization = models.TextField( null=True, blank=True, - help_text="Urbanization (Puerto Rico only)", + help_text="Urbanization (required for Puerto Rico only)", ) about_your_organization = models.TextField( @@ -487,6 +489,7 @@ class DomainApplication(TimeStampedModel): "registrar.Website", blank=True, related_name="current+", + verbose_name="websites", ) approved_domain = models.OneToOneField( @@ -532,6 +535,7 @@ class DomainApplication(TimeStampedModel): "registrar.Contact", blank=True, related_name="contact_applications", + verbose_name="contacts", ) no_other_contacts_rationale = models.TextField( @@ -543,7 +547,7 @@ class DomainApplication(TimeStampedModel): anything_else = models.TextField( null=True, blank=True, - help_text="Anything else we should know?", + help_text="Anything else?", ) is_policy_acknowledged = models.BooleanField( diff --git a/src/registrar/models/domain_information.py b/src/registrar/models/domain_information.py index d2bc5c53d..1d934f659 100644 --- a/src/registrar/models/domain_information.py +++ b/src/registrar/models/domain_information.py @@ -72,6 +72,7 @@ class DomainInformation(TimeStampedModel): ) federal_agency = models.TextField( + choices=AGENCY_CHOICES, null=True, blank=True, help_text="Federal agency", @@ -106,8 +107,8 @@ class DomainInformation(TimeStampedModel): address_line2 = models.TextField( null=True, blank=True, - help_text="Street address line 2", - verbose_name="Street address line 2", + help_text="Street address line 2 (optional)", + verbose_name="Street address line 2 (optional)", ) city = models.TextField( null=True, @@ -116,6 +117,7 @@ class DomainInformation(TimeStampedModel): ) state_territory = models.CharField( max_length=2, + choices=StateTerritoryChoices.choices, null=True, blank=True, help_text="State, territory, or military post", @@ -131,8 +133,8 @@ class DomainInformation(TimeStampedModel): urbanization = models.TextField( null=True, blank=True, - help_text="Urbanization (Puerto Rico only)", - verbose_name="Urbanization (Puerto Rico only)", + help_text="Urbanization (required for Puerto Rico only)", + verbose_name="Urbanization (required for Puerto Rico only)", ) about_your_organization = models.TextField( @@ -179,6 +181,7 @@ class DomainInformation(TimeStampedModel): "registrar.Contact", blank=True, related_name="contact_applications_information", + verbose_name="contacts", ) no_other_contacts_rationale = models.TextField( @@ -190,7 +193,7 @@ class DomainInformation(TimeStampedModel): anything_else = models.TextField( null=True, blank=True, - help_text="Anything else we should know?", + help_text="Anything else?", ) is_policy_acknowledged = models.BooleanField( diff --git a/src/registrar/models/transition_domain.py b/src/registrar/models/transition_domain.py index 9e6d40cf1..28bdc4fc7 100644 --- a/src/registrar/models/transition_domain.py +++ b/src/registrar/models/transition_domain.py @@ -84,7 +84,7 @@ class TransitionDomain(TimeStampedModel): middle_name = models.TextField( null=True, blank=True, - help_text="Middle name", + help_text="Middle name (optional)", ) last_name = models.TextField( null=True, diff --git a/src/registrar/models/user_group.py b/src/registrar/models/user_group.py index cf261286e..0f12a2e84 100644 --- a/src/registrar/models/user_group.py +++ b/src/registrar/models/user_group.py @@ -61,6 +61,11 @@ class UserGroup(Group): "model": "website", "permissions": ["change_website"], }, + { + "app_label": "registrar", + "model": "userdomainrole", + "permissions": ["view_userdomainrole", "delete_userdomainrole"], + }, ] # Avoid error: You can't execute queries until the end diff --git a/src/registrar/templates/admin/base_site.html b/src/registrar/templates/admin/base_site.html index dcdd29e2f..c0884c912 100644 --- a/src/registrar/templates/admin/base_site.html +++ b/src/registrar/templates/admin/base_site.html @@ -18,6 +18,7 @@ + {% endblock %} {% block title %}{% if subtitle %}{{ subtitle }} | {% endif %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %} diff --git a/src/registrar/templates/application_about_your_organization.html b/src/registrar/templates/application_about_your_organization.html index f1b843b7a..0d384b4f5 100644 --- a/src/registrar/templates/application_about_your_organization.html +++ b/src/registrar/templates/application_about_your_organization.html @@ -13,7 +13,7 @@ {% endblock %} {% block form_required_fields_help_text %} -

*This question is required.

+{# commented out so it does not appear on this page #} {% endblock %} {% block form_fields %} diff --git a/src/registrar/templates/application_anything_else.html b/src/registrar/templates/application_anything_else.html index 1c598db9a..f69b7e70e 100644 --- a/src/registrar/templates/application_anything_else.html +++ b/src/registrar/templates/application_anything_else.html @@ -2,7 +2,7 @@ {% load field_helpers %} {% block form_instructions %} -

Is there anything else we should know about your domain request?

+

Is there anything else you'd like us to know about your domain request? This question is optional.

{% endblock %} {% block form_required_fields_help_text %} diff --git a/src/registrar/templates/application_current_sites.html b/src/registrar/templates/application_current_sites.html index 627727ae3..67343aee9 100644 --- a/src/registrar/templates/application_current_sites.html +++ b/src/registrar/templates/application_current_sites.html @@ -4,7 +4,7 @@ {% block form_instructions %}

Enter your organization’s current public website, if you have one. For example, www.city.com. We can better evaluate your domain request if we know about domains -you’re already using. If you already have any .gov domains please include them.

+you’re already using. If you already have any .gov domains please include them. This question is optional.

{% endblock %} {% block form_required_fields_help_text %} diff --git a/src/registrar/templates/application_dotgov_domain.html b/src/registrar/templates/application_dotgov_domain.html index 0d11203ad..bd3c4a473 100644 --- a/src/registrar/templates/application_dotgov_domain.html +++ b/src/registrar/templates/application_dotgov_domain.html @@ -38,8 +38,7 @@
-

What .gov domain do you want? *

+

What .gov domain do you want?

After you enter your domain, we’ll make sure it’s @@ -47,8 +46,6 @@ these initial checks, we’ll verify that it meets all of our requirements once you complete and submit the rest of this form.

-

* This question is required.

- {% with attr_aria_describedby="domain_instructions domain_instructions2" %} {# attr_validate / validate="domain" invokes code in get-gov.js #} {% with append_gov=True attr_validate="domain" add_label_class="usa-sr-only" %} @@ -66,11 +63,11 @@
-

Alternative domains

+

Alternative domains (optional)

Are there other domains you’d like if we can’t give - you your first choice? Entering alternative domains is optional.

+ you your first choice?

{% with attr_aria_describedby="alt_domain_instructions" %} {# attr_validate / validate="domain" invokes code in get-gov.js #} diff --git a/src/registrar/templates/application_form.html b/src/registrar/templates/application_form.html index c4c3b2188..db72a1fc2 100644 --- a/src/registrar/templates/application_form.html +++ b/src/registrar/templates/application_form.html @@ -56,9 +56,12 @@ {% block form_instructions %} {% endblock %} -{% block form_required_fields_help_text %} - {% include "includes/required_fields.html" %} -{% endblock %} + +{% if steps.current != "no_other_contacts" %} + {% block form_required_fields_help_text %} + {% include "includes/required_fields.html" %} + {% endblock %} +{% endif %}
{% csrf_token %} diff --git a/src/registrar/templates/application_org_election.html b/src/registrar/templates/application_org_election.html index 45776af5c..04c8f2657 100644 --- a/src/registrar/templates/application_org_election.html +++ b/src/registrar/templates/application_org_election.html @@ -2,9 +2,7 @@ {% load field_helpers %} {% block form_instructions %} -

- Is your organization an election office? * -

+

Is your organization an election office?

An election office is a government entity whose primary responsibility is overseeing elections and/or conducting voter registration.

@@ -13,7 +11,7 @@ {% endblock %} {% block form_required_fields_help_text %} -

* This question is required.

+{# commented out so it does not appear on this page #} {% endblock %} {% block form_fields %} diff --git a/src/registrar/templates/application_org_federal.html b/src/registrar/templates/application_org_federal.html index 28cabadd0..8a5a574b0 100644 --- a/src/registrar/templates/application_org_federal.html +++ b/src/registrar/templates/application_org_federal.html @@ -3,15 +3,14 @@ {% block form_instructions %}

- Which federal branch is your organization in? * + Which federal branch is your organization in?

{% endblock %} {% block form_required_fields_help_text %} -

* This question is required.

+{# commented out so it does not appear on this page #} {% endblock %} - {% block form_fields %} {% with add_class="usa-radio__input--tile" add_legend_class="usa-sr-only" %} {% input_with_errors forms.0.federal_type %} diff --git a/src/registrar/templates/application_org_type.html b/src/registrar/templates/application_org_type.html index 80d599920..ef3fb82f7 100644 --- a/src/registrar/templates/application_org_type.html +++ b/src/registrar/templates/application_org_type.html @@ -3,16 +3,15 @@ {% block form_instructions %}

- What kind of U.S.-based government organization do you represent? * + What kind of U.S.-based government organization do you represent?

{% endblock %} {% block form_required_fields_help_text %} -

* This question is required.

+{# commented out so it does not appear on this page #} {% endblock %} - {% block form_fields %} {% with add_class="usa-radio__input--tile" add_legend_class="usa-sr-only" %} {% input_with_errors forms.0.organization_type %} diff --git a/src/registrar/templates/application_other_contacts.html b/src/registrar/templates/application_other_contacts.html index 679742281..a3f0971dc 100644 --- a/src/registrar/templates/application_other_contacts.html +++ b/src/registrar/templates/application_other_contacts.html @@ -13,18 +13,16 @@ {% endblock %} {% block form_required_fields_help_text %} -{# there are no required fields on this page so don't show this #} +{% include "includes/required_fields.html" %} {% endblock %} - - {% block form_fields %} {{ forms.0.management_form }} {# forms.0 is a formset and this iterates over its forms #} {% for form in forms.0.forms %}
-

Organization contact {{ forloop.counter }}

+

Organization contact {{ forloop.counter }} (optional)

{% input_with_errors form.first_name %} diff --git a/src/registrar/templates/application_purpose.html b/src/registrar/templates/application_purpose.html index 5135e6678..8747a34c7 100644 --- a/src/registrar/templates/application_purpose.html +++ b/src/registrar/templates/application_purpose.html @@ -13,11 +13,9 @@ Read about * This question is required.

+{# commented out so it does not appear on this page #} {% endblock %} - - {% block form_fields %} {% with attr_maxlength=1000 add_label_class="usa-sr-only" %} {% input_with_errors forms.0.purpose %} diff --git a/src/registrar/templates/application_requirements.html b/src/registrar/templates/application_requirements.html index ef0a4c7ef..c1600d523 100644 --- a/src/registrar/templates/application_requirements.html +++ b/src/registrar/templates/application_requirements.html @@ -50,6 +50,10 @@

We understand the critical importance of the availability of .gov domains. Suspending or terminating a .gov domain is reserved for prolonged, unresolved, serious violations where the registrant is non-responsive. We'll make extensive efforts to contact registrants and to identify potential solutions. We'll make reasonable accommodations for remediation timelines based on the severity of the issue.

{% endblock %} +{% block form_required_fields_help_text %} +{# commented out so it does not appear on this page #} +{% endblock %} + {% block form_fields %}
diff --git a/src/registrar/templates/application_status.html b/src/registrar/templates/application_status.html index 79d0f7ff9..3bf02f0e0 100644 --- a/src/registrar/templates/application_status.html +++ b/src/registrar/templates/application_status.html @@ -111,7 +111,7 @@ {% include "includes/summary_item.html" with title='Other employees from your organization' value=domainapplication.other_contacts.all contact='true' list='true' heading_level=heading_level %} - {% include "includes/summary_item.html" with title='Anything else we should know' value=domainapplication.anything_else|default:"No" heading_level=heading_level %} + {% include "includes/summary_item.html" with title='Anything else?' value=domainapplication.anything_else|default:"No" heading_level=heading_level %} {% endwith %} diff --git a/src/registrar/templates/base.html b/src/registrar/templates/base.html index caecee9f3..b4aeba704 100644 --- a/src/registrar/templates/base.html +++ b/src/registrar/templates/base.html @@ -1,5 +1,7 @@ {# keep this on the first line #} {% load i18n static %} +{% load static url_helpers %} + @@ -144,13 +146,13 @@
- {% block logo %} - - {% endblock %} + {% block logo %} + + {% endblock %}
{% block usa_nav %} diff --git a/src/registrar/templates/django/admin/domain_change_form.html b/src/registrar/templates/django/admin/domain_change_form.html index 6c401ad72..c4461d07f 100644 --- a/src/registrar/templates/django/admin/domain_change_form.html +++ b/src/registrar/templates/django/admin/domain_change_form.html @@ -1,11 +1,6 @@ {% extends 'admin/change_form.html' %} {% load i18n static %} -{% block extrahead %} -{{ block.super }} - -{% endblock %} - {% block field_sets %}
diff --git a/src/registrar/templates/django/forms/label.html b/src/registrar/templates/django/forms/label.html index da90a372a..18d24a7bd 100644 --- a/src/registrar/templates/django/forms/label.html +++ b/src/registrar/templates/django/forms/label.html @@ -7,7 +7,13 @@ {% else %} {{ field.label }} {% endif %} + {% if widget.attrs.required %} - * + + {% if field.label == "Is your organization an election office?" or field.label == "What .gov domain do you want?" or field.label == "I read and agree to the requirements for operating .gov domains." or field.label == "Please explain why there are no other employees from your organization we can contact to help us assess your eligibility for a .gov domain." %} + {% else %} + * + {% endif %} {% endif %} + diff --git a/src/registrar/templates/domain_base.html b/src/registrar/templates/domain_base.html index b5f70d341..90c730028 100644 --- a/src/registrar/templates/domain_base.html +++ b/src/registrar/templates/domain_base.html @@ -5,17 +5,15 @@ {% block content %}
-
- {% if not is_analyst_or_superuser or not analyst_action or analyst_action_location != domain.pk %} -

- Domain name: {{ domain.name }} -

- {% endif %} -
+
+

+ Domain name: {{ domain.name }} +

+ {% if domain.domain_info %} {% include 'domain_sidebar.html' %} {% endif %} @@ -42,16 +40,6 @@

- {% else %} - - - -

- Back to manage your domains -

-
{% endif %} {# messages block is under the back breadcrumb link #} {% if messages %} diff --git a/src/registrar/templates/emails/includes/application_summary.txt b/src/registrar/templates/emails/includes/application_summary.txt index 293dad2e4..c628e1074 100644 --- a/src/registrar/templates/emails/includes/application_summary.txt +++ b/src/registrar/templates/emails/includes/application_summary.txt @@ -34,6 +34,6 @@ Other employees from your organization: {% for other in application.other_contacts.all %} {% spaceless %}{% include "emails/includes/contact.txt" with contact=other %}{% endspaceless %} {% endfor %}{% endif %}{% if application.anything_else %} -Anything else we should know? +Anything else? {{ application.anything_else }} {% endif %} \ No newline at end of file diff --git a/src/registrar/templates/includes/footer.html b/src/registrar/templates/includes/footer.html index 47d4836f1..303c0ef74 100644 --- a/src/registrar/templates/includes/footer.html +++ b/src/registrar/templates/includes/footer.html @@ -26,6 +26,10 @@ >