Skip to content

Commit

Permalink
Update to community response notification signup form.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanetteobr committed Dec 31, 2024
1 parent 916652d commit 396a332
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 33 deletions.
19 changes: 4 additions & 15 deletions apps/notifications/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Generated by Django 3.2.23 on 2024-12-31 05:42

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.AddField(
model_name='communityresponsesubscriber',
name='organization_mission_statement',
field=models.CharField(default='', max_length=255, verbose_name='Mission Statement'),
),
migrations.AddField(
model_name='communityresponsesubscriber',
name='organization_type',
field=models.CharField(blank=True, choices=[("('Arts and Culture', 'Arts and Culture')", 'Arts Culture'), ("('Block Captain', 'Block Captain')", 'Block Captain'), ("('Civic Engagement/Elected Official', 'Civic Engagement/Elected Official')", 'Civic Engagement Elected Official'), ("('Disabilities and Access and Functional Needs', 'Disabilities and Access and Functional Needs')", 'Disabilities Access Functional Needs'), ("('Education (Schools/Colleges/Universities)', 'Education (Schools/Colleges/Universities)')", 'Education'), ("('Free Library of Philadelphia', 'Free Library of Philadelphia')", 'Free Library Of Philadelphia'), ("('General Community Services', 'General Community Services')", 'General Community Services'), ("('Healthcare', 'Healthcare')", 'Healthcare'), ("('Immigrante/Refugee/Communities that speak languages other than English', 'Immigrante/Refugee/Communities that speak languages other than English')", 'Immigrant Refugee Communities'), ("('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')], default='', max_length=150, verbose_name='Organization Type*'),
),
migrations.AlterField(
model_name='communityresponsesubscriber',
name='cell_phone',
field=phonenumber_field.modelfields.PhoneNumberField(max_length=128, region=None, verbose_name='Cell Phone'),
),
migrations.AlterField(
model_name='communityresponsesubscriber',
name='first_name',
field=models.CharField(default='', max_length=255, verbose_name='First Name'),
),
migrations.AlterField(
model_name='communityresponsesubscriber',
name='last_name',
field=models.CharField(default='', max_length=255, verbose_name='Last Name'),
),
migrations.AlterField(
model_name='communityresponsesubscriber',
name='organization_community_members_served',
field=models.CharField(choices=[('Children/Youth', 'Children/Youth'), ('Older Adults', 'Older Adults'), ('Marginalized racial or ethnic group', 'Marginalized racial or ethnic group'), ('Immigrant', 'Immigrant'), ('refugee or undocumented communities', 'refugee or undocumented communities'), ('Gender non-conforming/non-binary', 'Gender non-conforming/non-binary'), ('LGBTQ+', 'LGBTQ+'), ('Unemployed', 'Unemployed'), ('Uninsured/Underinsured', 'Uninsured/Underinsured'), ('Experiencing homelessness', 'Experiencing homelessness'), ('Low-income communities', 'Low-income communities'), ('People with disabilities', 'People with disabilities'), ('People who are homebound', 'People who are homebound'), ('Living with a mental illness', 'Living with a mental illness'), ('Living with a substance use disorder', 'Living with a substance use disorder'), ('Chronically ill', 'Chronically ill'), ('Returning citizens', 'Returning citizens'), ('Currently incarcerated', 'Currently incarcerated'), ('Faith communities', 'Faith communities'), ('Minimal to no digital access', 'Minimal to no digital access'), ('Pregnant', 'Pregnant'), ('Single parent', 'Single parent'), ('Veterans', 'Veterans'), ('Limited English proficient', 'Limited English proficient'), ('Caregiver dependent', 'Caregiver dependent'), ('No access to private vehicle', 'No access to private vehicle'), ('Dependent on prescription medications', 'Dependent on prescription medications'), ('Living in a congregate setting', 'Living in a congregate setting'), ('Students', 'Students'), ('Survivors of violence or abuse', 'Survivors of violence or abuse'), ('Essential worker', 'Essential worker'), ('General public', 'General public'), ('Other', 'Other'), ('All of these', 'All of these')], max_length=100, verbose_name='Community Members Served'),
),
]
106 changes: 94 additions & 12 deletions apps/notifications/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,91 @@ 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",
"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 = (
"Immigrante/Refugee/Communities that speak languages other than English",
"Immigrante/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="",
)
last_name = models.CharField(
"Last Name*",
"Last Name",
max_length=255,
default="",
)
Expand All @@ -361,29 +439,33 @@ class COMMUNITY_MEMBERS_CHOICES(models.TextChoices):
)

email_address = models.EmailField("Email Address*")
cell_phone = PhoneNumberField("Cell Phone*")
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
organization_type = models.CharField(
"Organization Type*",
max_length=150,
default="",
choices=ORGANIZATION_TYPE_CHOICES.choices,
blank=True,
)
organization_zip_code = models.CharField(
"Zip Code of Organization*",
max_length=10,
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*",
"Community Members Served",
max_length=100,
choices=COMMUNITY_MEMBERS_CHOICES.choices,
)

organization_mission_statement = models.CharField(
"Mission Statement",
max_length=255,
default="",
)

class Meta:
verbose_name_plural = "Community Response Subscribers"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ <h5 class="is-size-5 pt-2 pl-4">
<h6 class="is-size-6 py-2"><strong>{{ form_section.header }}</strong></h6>
{% for field in form_section.fields %}
<div class="py-2 field form-sections-hip">
<label class="label is-block is-size-7" for="{{ field.id_for_label }}">{{ field.label }}</label>
<label class="label is-block is-size-7" for="{{ field.id_for_label }}">
{% if "*" in field.label %}
{{ field.label|slice:":-1" }}<span class="required">*</span>
{% else %}
{{ field.label }}
{% endif %}
</label>
<div class="control">
{% if field|widget_class == "Select" %}
<div class="select is-small">
Expand Down
9 changes: 4 additions & 5 deletions apps/notifications/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,17 @@ class Meta:
first_name = factory.faker.Faker("first_name")
last_name = factory.faker.Faker("last_name")
organization_name = factory.faker.Faker("company")
organization_type = random.choice(
[str(l) for l in CommunityResponseSubscriber.ORGANIZATION_TYPE_CHOICES]
)
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_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_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):
Expand Down
4 changes: 4 additions & 0 deletions hip/static/styles/includes/notification_signup.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
@include headers;
@include paragraphs;
}

.required {
color: red;
}

0 comments on commit 396a332

Please sign in to comment.