def location(self, group): return section_path(FrontEndSection.AboutGroup.value, {'id': group.id})
def location(self, event): event_id = event.event_slug or event.id return section_path(FrontEndSection.AboutEvent.value, {'id': event_id})
def test_section_path(self): expected = '/index/?section=AboutEvent&id=test-slug' self.assertEqual( expected, section_path(FrontEndSection.AboutEvent, {'id': 'test-slug'}))
def location(self, project): return section_path(FrontEndSection.AboutProject.value, {'id': project.id})
def location(self, page): return section_path(page)
def test_section_path(self): expected = '/events/test-slug' self.assertEqual( expected, section_path(FrontEndSection.AboutEvent, {'id': 'test-slug'}))
'project_name': project.project_name, 'project_end_date': datetime_to_string(datetime_field_to_datetime(volunteer_relation.projected_end_date), DateTimeFormats.DATE_LOCALIZED), 'volunteer_start_date': datetime_to_string(datetime_field_to_datetime(volunteer_relation.application_date), DateTimeFormats.DATE_LOCALIZED) } email_msg = EmailMessage( subject="You're making a difference at " + project.project_name, from_email=_get_account_from_email(settings.EMAIL_VOLUNTEER_ACCT), to=[volunteer.email], ) email_msg = email_template.render(email_msg, context) send_email(email_msg, settings.EMAIL_VOLUNTEER_ACCT) review_commitment_url = settings.PROTOCOL_DOMAIN + section_path(FrontEndSection.MyProjects, {'from': 'renewal_notification_email'}) def get_first_email_template(): return HtmlEmailTemplate() \ .header("You're making a difference at {{project_name}}") \ .paragraph("We'd like to take this opportunity to thank you for your support since {{volunteer_start_date}}. " "Your engagement with {{project_name}} is extremely important to us and is much appreciated.") \ .paragraph("That said, we know you’re busy and just wanted to take this time to remind you that your " "volunteer commitment with {{project_name}} will expire on {{project_end_date}}.") \ .paragraph("We hope that you’ll take this time to renew your volunteer commitment and remain a part of our community.") \ .button(url=review_commitment_url, text='REVIEW COMMITMENT') def get_second_email_template(): return HtmlEmailTemplate() \
def test_section_path_with_multiple_args(self): expected_pattern = re.compile(r'/events/test-slug(\?a=1&b=2|\?b=2&a=1)') arg_dict = {'id': 'test-slug', 'a': '1', 'b': '2'} self.assertRegexpMatches(section_path(FrontEndSection.AboutEvent, arg_dict), expected_pattern)
def test_section_path_with_single_arg(self): expected = '/events/test-slug?a=1' arg_dict = {'id': 'test-slug', 'a': '1'} self.assertEqual(expected, section_path(FrontEndSection.AboutEvent, arg_dict))