How to use the intake.models.Application 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 / features / steps / pdf_steps.py View on Github external
def test_applicant_in_prebuilt_pdf_for_org(context, applicant_names, org_slug):
    applicant_names = oxford_comma_text_to_list(applicant_names)
    app_ids = []
    for applicant_name in applicant_names:
        first_name, last_name = applicant_name.split(' ')
        app_ids.append(
            models.Application.objects.filter(
                form_submission__first_name=first_name,
                form_submission__last_name=last_name,
                organization__slug=org_slug).first().id)
    prebuilt = pdf_service.get_prebuilt_pdf_bundle_for_app_id_set(app_ids)
    context.test.assertTrue(prebuilt)
github codeforamerica / intake / intake / serializers / app_index_serializers.py View on Github external
'first_name',
            'last_name',
            'url',
            'printout_url',
            'phone_number',
            'email',
        ]


class ApplicationIndexSerializer(LatestStatusBase):
    local_created = fields.LocalDateField(source='created')
    form_submission = FormSubmissionIndexSerializer()
    status_updates = MinimalStatusUpdateSerializer(many=True)

    class Meta:
        model = models.Application
        fields = [
            'local_created',
            'status_updates',
            'form_submission',
            'was_transferred_out',
            'has_been_opened'
        ]


class ApplicationIndexWithTransfersSerializer(ApplicationIndexSerializer):
    incoming_transfers = IncomingTransferSerializer(many=True)

    class Meta:
        model = models.Application
        fields = [
            'local_created',
github codeforamerica / intake / intake / services / bundles.py View on Github external
def mark_opened(bundle, user):
    submission_ids = FormSubmission.objects.filter(
        bundles=bundle).values_list('id', flat=True)
    Application.objects.filter(
        form_submission_id__in=submission_ids,
        organization_id=user.profile.organization.id
    ).distinct().update(has_been_opened=True)
    EventsService.bundle_opened(bundle, user)
github codeforamerica / intake / user_accounts / models / organization.py View on Github external
def add_orgs_to_sub(self, *orgs):
        sub = self.extract_sub()
        if sub and orgs:
            applications = [
                intake_models.Application(
                    form_submission=sub,
                    organization_id=org_id)
                for org_id in coerce_to_ids(orgs)
            ]
            intake_models.Application.objects.bulk_create(applications)
github codeforamerica / intake / intake / services / transfers_service.py View on Github external
def transfer_application(author, application, to_organization, reason):
    """Transfers an application from one organization to another.
    Returns three things as a tuple:
        - a new ApplicationTransfer instance
        - a new StatusUpdate instance
        - a new Application instance for the to_organization
    """
    transferred_status_type = models.StatusType.objects.get(slug='transferred')
    transfer_status_update = models.StatusUpdate(
        status_type=transferred_status_type,
        author_id=author.id,
        application=application)
    transfer_status_update.save()
    new_application = models.Application(
        form_submission_id=application.form_submission_id,
        organization=to_organization)
    new_application.save()
    transfer = models.ApplicationTransfer(
        status_update=transfer_status_update,
        new_application=new_application,
        reason=reason)
    transfer.save()
    application.was_transferred_out = True
    application.save()
    EventsService.app_transferred(application, new_application, author)
    EventsService.user_app_transferred(application, new_application, author)
    return transfer, transfer_status_update, new_application
github codeforamerica / intake / intake / services / pdf_service.py View on Github external
def fill_any_unfilled_pdfs_for_app_ids(app_ids):
    apps_without_pdfs = models.Application.objects.annotate(
        filled_pdf_count=Count('form_submission__filled_pdfs')
    ).filter(id__in=app_ids, filled_pdf_count=0)
    # build individual filled pdfs if necessary
    for app in apps_without_pdfs:
        fill_pdf_for_application(app.id)