How to use the intake.services.events_service function in intake

To help you get started, we’ve selected a few intake examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codeforamerica / intake / intake / views / select_county_view.py View on Github external
def form_valid(self, form):
        EventsService.form_started(
            self, counties=form.parsed_data['counties'])
        return super().form_valid(form)
github codeforamerica / intake / user_accounts / views.py View on Github external
def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        # if there is an login email in the session
        login_email = self.request.session.get('failed_login_email', '')
        initial_email = context['form'].initial.get('email', '')
        if not initial_email:
            context['form'].initial['email'] = login_email
        EventsService.user_reset_password(self, initial_email)
        return context
github codeforamerica / intake / intake / services / applications_service.py View on Github external
def handle_apps_opened(view, apps):
    apps = coerce_possible_ids_to_apps(apps)
    EventsService.apps_opened(view, apps)
    EventsService.user_apps_opened(view, apps)
    for app in apps:
        should_be_marked = \
            view.request.user.profile.organization_id == app.organization_id
        if should_be_marked:
            app.has_been_opened = True
            app.save()
            tasks.remove_application_pdfs.delay(app.id)
github codeforamerica / intake / intake / services / applications_service.py View on Github external
def handle_apps_opened(view, apps):
    apps = coerce_possible_ids_to_apps(apps)
    EventsService.apps_opened(view, apps)
    EventsService.user_apps_opened(view, apps)
    for app in apps:
        should_be_marked = \
            view.request.user.profile.organization_id == app.organization_id
        if should_be_marked:
            app.has_been_opened = True
            app.save()
            tasks.remove_application_pdfs.delay(app.id)
github codeforamerica / intake / intake / views / applicant_form_view_base.py View on Github external
def log_page_completion_and_save_data(self, form):
        EventsService.form_page_complete(self)
        utils.save_form_data_to_session(
            self.request, self.session_key, form.data)
github codeforamerica / intake / intake / views / status_update_views.py View on Github external
def form_valid(self, form):
        status_update = StatusNotificationService.send_and_save_new_status(
            self.request,
            form.cleaned_data,
            self.existing_status_update_data)
        EventsService.status_updated(self, status_update)
        EventsService.user_status_updated(self, status_update)
        utils.clear_form_data_from_session(
            self.request, self.get_session_storage_key())
        return super().form_valid(form)
github codeforamerica / intake / intake / views / application_note_views.py View on Github external
def perform_create(self, serializer):
        note = serializer.save()
        EventsService.note_added(self, note.submission)
github codeforamerica / intake / intake / services / followups.py View on Github external
def send_followup_notifications(submissions):
    """Sends an email or text via front, based on contact preferences
    """
    notifications = []
    for submission in submissions:
        followup_notification = FollowupNotification(submission)
        followup_notification.send()
        if followup_notification.successes:
            EventsService.followup_sent(
                submission, followup_notification.contact_methods)
            submission.has_been_sent_followup = True
            submission.save()
        notifications.append(followup_notification)
    return notifications
github codeforamerica / intake / partnerships / views.py View on Github external
def form_valid(self, form):
        partnership_lead = form.save(commit=False)
        partnership_lead.visitor = self.request.visitor
        partnership_lead.save()
        self.send_email(form.cleaned_data)
        EventsService.partnership_interest_submitted(self, partnership_lead)
        success_message = self.success_message_template.format(
            partnerships_lead_inbox=settings.PARTNERSHIPS_LEAD_INBOX)
        messages.success(self.request, success_message, extra_tags='safe')
        return redirect(reverse('partnerships-home'))
github codeforamerica / intake / user_accounts / views.py View on Github external
def form_valid(self, form):
        response = super().form_valid(form)
        self.request.user = self.user
        EventsService.user_account_created(self)
        return response