diff --git a/apps/conftest.py b/apps/conftest.py index a2759618..aecfb99a 100644 --- a/apps/conftest.py +++ b/apps/conftest.py @@ -250,15 +250,13 @@ def community_response_notification_data(): return dict( first_name="SpongeBob", last_name="SquarePants", - organization_name="Krabby Patty Organization", - title="Fry Cook", email_address="spongebob@phila.gov", cell_phone="(215)333-4567", - organization_street_address="831 Bottom Feeder Lane", - organization_po_box="1", + organization_name="Krabby Patty Organization", + organization_type="Arts and Culture", organization_zip_code=98765, - organization_zip_codes_served="98765,99999", organization_community_members_served="All of these", + organization_mision_statement="To make the best Krabby Patties", ) diff --git a/apps/notifications/admin.py b/apps/notifications/admin.py index 0f59ba04..08c84a57 100644 --- a/apps/notifications/admin.py +++ b/apps/notifications/admin.py @@ -39,14 +39,12 @@ class CommunityResponseSubscriberAdmin(ExportMixin, admin.ModelAdmin): list_display = ( "full_name", "organization_name", - "title", ) list_filter = ("organization_community_members_served",) search_fields = ( "first_name", "last_name", "organization_name", - "title", "email_address", ) diff --git a/apps/notifications/forms.py b/apps/notifications/forms.py index 032b5b94..1ab1728a 100644 --- a/apps/notifications/forms.py +++ b/apps/notifications/forms.py @@ -98,25 +98,18 @@ def about_you_fields(self): about_you_field_names = [ "first_name", "last_name", - "organization_name", - "title", - ] - return [self[name] for name in self.fields if name in about_you_field_names] - - def contact_information_fields(self): - contact_info_field_names = [ "email_address", "cell_phone", ] - return [self[name] for name in self.fields if name in contact_info_field_names] + return [self[name] for name in self.fields if name in about_you_field_names] def organization_info_fields(self): organization_info_field_names = [ - "organization_street_address", - "organization_po_box", + "organization_name", + "organization_type", "organization_zip_code", - "organization_zip_codes_served", "organization_community_members_served", + "organization_mission_statement", ] return [ self[name] for name in self.fields if name in organization_info_field_names @@ -126,10 +119,6 @@ def form_sections(self): """Return the sections of this form, including a header, and the fields in the section.""" return [ {"header": "About You", "fields": self.about_you_fields()}, - { - "header": "Contact Information", - "fields": self.contact_information_fields(), - }, { "header": "Organization Information", "fields": self.organization_info_fields(), diff --git a/apps/notifications/migrations/0009_alter_communityresponsesubscriber_fields.py b/apps/notifications/migrations/0009_alter_communityresponsesubscriber_fields.py new file mode 100644 index 00000000..22f963d6 --- /dev/null +++ b/apps/notifications/migrations/0009_alter_communityresponsesubscriber_fields.py @@ -0,0 +1,101 @@ +# Generated by Django 4.2.14 on 2025-01-02 19:57 + +from django.db import migrations, models + +import phonenumber_field.modelfields + + +class Migration(migrations.Migration): + + dependencies = [ + ("notifications", "0008_coderedcodebluesubscriber_fields_are_optional"), + ] + + operations = [ + migrations.RemoveField( + model_name="communityresponsesubscriber", + name="organization_po_box", + ), + migrations.RemoveField( + model_name="communityresponsesubscriber", + name="organization_street_address", + ), + migrations.RemoveField( + model_name="communityresponsesubscriber", + name="organization_zip_codes_served", + ), + migrations.RemoveField( + model_name="communityresponsesubscriber", + name="title", + ), + migrations.AddField( + model_name="communityresponsesubscriber", + name="organization_mission_statement", + field=models.CharField( + blank=True, max_length=255, verbose_name="Mission Statement" + ), + ), + migrations.AddField( + model_name="communityresponsesubscriber", + name="organization_type", + field=models.CharField( + choices=[ + ("Arts and Culture", "Arts and Culture"), + ("Block Captain", "Block Captain"), + ( + "Civic Engagement/Elected Official", + "Civic Engagement/Elected Official", + ), + ( + "Disabilities and Access and Functional Needs", + "Disabilities and Access and Functional Needs", + ), + ( + "Education (Schools/Colleges/Universities)", + "Education (Schools/Colleges/Universities)", + ), + ("Free Library of Philadelphia", "Free Library of Philadelphia"), + ("General Community Services", "General Community Services"), + ("Healthcare", "Healthcare"), + ( + "Immigrant/Refugee/Communities that speak languages other than English", + "Immigrant/Refugee/Communities that speak languages other than English", + ), + ("Live Bird Market", "Live Bird Market"), + ("Mental/Behavioral Health", "Mental/Behavioral Health"), + ("Older Adults", "Older Adults"), + ("Housing/Homeless Services", "Housing/Homeless Services"), + ("RCO/CDC/NAC", "RCO/CDC/NAC"), + ("Recreational", "Recreational"), + ("Religious/Faith-based", "Religious/Faith-based"), + ("Workers", "Workers"), + ("Youth", "Youth"), + ("Unaffiliated Community Leader", "Unaffiliated Community Leader"), + ], + default="", + max_length=255, + verbose_name="Organization Type*", + ), + ), + migrations.AlterField( + model_name="communityresponsesubscriber", + name="cell_phone", + field=phonenumber_field.modelfields.PhoneNumberField( + blank=True, max_length=128, region=None, verbose_name="Cell Phone" + ), + ), + migrations.AlterField( + model_name="communityresponsesubscriber", + name="first_name", + field=models.CharField( + blank=True, max_length=255, verbose_name="First Name" + ), + ), + migrations.AlterField( + model_name="communityresponsesubscriber", + name="last_name", + field=models.CharField( + blank=True, max_length=255, verbose_name="Last Name" + ), + ), + ] diff --git a/apps/notifications/models.py b/apps/notifications/models.py index 5c0c2bba..6d11cc21 100644 --- a/apps/notifications/models.py +++ b/apps/notifications/models.py @@ -339,35 +339,104 @@ class COMMUNITY_MEMBERS_CHOICES(models.TextChoices): "All of these", ) + class ORGANIZATION_TYPE_CHOICES(models.TextChoices): + ARTS_CULTURE = ( + "Arts and Culture", + "Arts and Culture", + ) + BLOCK_CAPTAIN = ("Block Captain",) + CIVIC_ENGAGEMENT_ELECTED_OFFICIAL = ( + "Civic Engagement/Elected Official", + "Civic Engagement/Elected Official", + ) + DISABILITIES_ACCESS_FUNCTIONAL_NEEDS = ( + "Disabilities and Access and Functional Needs", + "Disabilities and Access and Functional Needs", + ) + EDUCATION = ( + "Education (Schools/Colleges/Universities)", + "Education (Schools/Colleges/Universities)", + ) + FREE_LIBRARY_OF_PHILADELPHIA = ( + "Free Library of Philadelphia", + "Free Library of Philadelphia", + ) + GENERAL_COMMUNITY_SERVICES = ( + "General Community Services", + "General Community Services", + ) + HEALTHCARE = ( + "Healthcare", + "Healthcare", + ) + IMMIGRANT_REFUGEE_COMMUNITIES = ( + "Immigrant/Refugee/Communities that speak languages other than English", + "Immigrant/Refugee/Communities that speak languages other than English", + ) + LIVE_BIRD_MARKET = ( + "Live Bird Market", + "Live Bird Market", + ) + MENTAL_BEHAVIORAL_HEALTH = ( + "Mental/Behavioral Health", + "Mental/Behavioral Health", + ) + OLDER_ADULTS = ( + "Older Adults", + "Older Adults", + ) + HOUSING_HOMELESS_SERVICES = ( + "Housing/Homeless Services", + "Housing/Homeless Services", + ) + RCO_CDC_NAC = ( + "RCO/CDC/NAC", + "RCO/CDC/NAC", + ) + RECREATIONAL = ( + "Recreational", + "Recreational", + ) + RELIGIOUS_FAITH_BASED = ( + "Religious/Faith-based", + "Religious/Faith-based", + ) + WORKERS = ( + "Workers", + "Workers", + ) + YOUTH = ( + "Youth", + "Youth", + ) + UNAFFILIATED_COMMUNITY_LEADER = ( + "Unaffiliated Community Leader", + "Unaffiliated Community Leader", + ) + first_name = models.CharField( - "First Name*", + "First Name", max_length=255, - default="", + blank=True, ) last_name = models.CharField( - "Last Name*", + "Last Name", max_length=255, - default="", + blank=True, ) organization_name = models.CharField( "Organization Name*", max_length=255, default="", ) - title = models.CharField( - "Title/Position*", - max_length=255, - default="", - ) email_address = models.EmailField("Email Address*") - cell_phone = PhoneNumberField("Cell Phone*") - - organization_street_address = models.CharField( - "Street Address of Organization*", max_length=255 - ) - organization_po_box = models.CharField( - "Organization PO Box", max_length=255, blank=True + cell_phone = PhoneNumberField("Cell Phone", blank=True) + organization_type = models.CharField( + "Organization Type*", + max_length=255, + choices=ORGANIZATION_TYPE_CHOICES.choices, + default="", ) organization_zip_code = models.CharField( "Zip Code of Organization*", @@ -375,14 +444,16 @@ class COMMUNITY_MEMBERS_CHOICES(models.TextChoices): default="", validators=[zipcode_validator], ) - organization_zip_codes_served = models.CharField( - "Zip Codes Served by Your Organization*", max_length=255, default="" - ) organization_community_members_served = models.CharField( "Community Members Served by Your Organization*", max_length=100, choices=COMMUNITY_MEMBERS_CHOICES.choices, ) + organization_mission_statement = models.CharField( + "Mission Statement", + max_length=255, + blank=True, + ) class Meta: verbose_name_plural = "Community Response Subscribers" diff --git a/apps/notifications/templates/notifications/notification_signup.html b/apps/notifications/templates/notifications/notification_signup.html index fcc56388..7b698629 100644 --- a/apps/notifications/templates/notifications/notification_signup.html +++ b/apps/notifications/templates/notifications/notification_signup.html @@ -30,7 +30,13 @@
{{ form_section.header }}
{% for field in form_section.fields %}
- +
{% if field|widget_class == "Select" %}
diff --git a/apps/notifications/tests/factories.py b/apps/notifications/tests/factories.py index de4ec75e..c29509eb 100644 --- a/apps/notifications/tests/factories.py +++ b/apps/notifications/tests/factories.py @@ -30,19 +30,17 @@ class Meta: first_name = factory.faker.Faker("first_name") last_name = factory.faker.Faker("last_name") - organization_name = factory.faker.Faker("company") - title = factory.faker.Faker("job") email_address = factory.faker.Faker("email") cell_phone = factory.faker.Faker("phone_number") - organization_street_address = factory.faker.Faker("street_address") - organization_po_box = random.randint(0, 9999) + organization_name = factory.faker.Faker("company") organization_zip_code = factory.faker.Faker("postcode") - organization_zip_codes_served = ", ".join( - [str(random.randint(11111, 99999)) for i in range(0, random.randint(0, 5))] + organization_type = random.choice( + [str(t) for t in CommunityResponseSubscriber.ORGANIZATION_TYPE_CHOICES] ) organization_community_members_served = random.choice( [str(l) for l in CommunityResponseSubscriber.COMMUNITY_MEMBERS_CHOICES] ) + organization_mission_statement = factory.faker.Faker("text") class InternalEmployeeAlertSubscriberFactory(factory.django.DjangoModelFactory): diff --git a/apps/notifications/tests/test_views.py b/apps/notifications/tests/test_views.py index a49bfee9..c4cc2fa2 100644 --- a/apps/notifications/tests/test_views.py +++ b/apps/notifications/tests/test_views.py @@ -171,12 +171,12 @@ def test_community_response_notification_signup_invalid_data( ): """POSTting invalid data shows errors to the user.""" data = community_response_notification_data.copy() - data.pop("first_name") + data.pop("email_address") response = client.post(reverse("community_notifications_signup"), data) assert HTTPStatus.OK == response.status_code - assert {"first_name": ["This field is required."]} == response.context[ + assert {"email_address": ["This field is required."]} == response.context[ "form" ].errors diff --git a/hip/static/styles/includes/notification_signup.scss b/hip/static/styles/includes/notification_signup.scss index c749df82..83b0b233 100644 --- a/hip/static/styles/includes/notification_signup.scss +++ b/hip/static/styles/includes/notification_signup.scss @@ -5,3 +5,7 @@ @include headers; @include paragraphs; } + +.required { + color: red; +} \ No newline at end of file