def get(self, request, bundle_id): bundle = get_object_or_404(models.ApplicationBundle, pk=int(bundle_id)) if bundle.organization_id != request.user.profile.organization_id: return not_allowed(request) filename, pdf_bytes = get_concatenated_printout_for_bundle( request.user, bundle) response = HttpResponse(pdf_bytes, content_type='application/pdf') response['Content-Disposition'] = 'filename="{}"'.format(filename) return response
def get(self, request, submission_id): submission = get_object_or_404(models.FormSubmission, pk=int(submission_id)) if not submission.organizations.filter( id=request.user.profile.organization_id).exists(): return not_allowed(request) filename, pdf_bytes = get_printout_for_submission( request.user, submission) response = HttpResponse(pdf_bytes, content_type='application/pdf') response['Content-Disposition'] = 'filename="{}"'.format(filename) return response
def get(self, request): self.request = request self.submissions = self.get_submissions_from_params(request) if not self.submissions: return not_allowed(request) self.submission_ids = [sub.id for sub in self.submissions] self.next_param = request.GET.get('next', reverse_lazy('intake-app_index')) self.log() self.modify_submissions() self.add_message() self.notify() return redirect(self.next_param)
def get(self, request, bundle_id): bundle = get_object_or_404( models.ApplicationBundle, pk=int(bundle_id)) if bundle.organization_id != request.user.profile.organization_id: return not_allowed(request) BundlesService.mark_opened( bundle, request.user, send_slack_notification=False) filename, pdf_bytes = get_concatenated_printout_for_bundle( request.user, bundle) response = HttpResponse( pdf_bytes, content_type='application/pdf') response['Content-Disposition'] = 'filename="{}"'.format(filename) return response
def dispatch(self, request, submission_id, *args, **kwargs): self.next_url = request.GET.get('next', reverse_lazy('intake-app_index')) self.author = request.user self.from_organization = request.user.profile.organization self.to_organization = \ request.user.profile.organization.transfer_partners.first() submission_id = int(submission_id) self.submission = models.FormSubmission.objects.get(id=submission_id) self.application = self.submission.applications.filter( organization=self.from_organization).first() if not self.to_organization or not self.application: return not_allowed(request) return super().dispatch(request, *args, **kwargs)
def get(self, request, submission_id): submission = get_object_or_404( models.FormSubmission, pk=int(submission_id)) if not submission.organizations.filter( id=request.user.profile.organization_id).exists(): return not_allowed(request) SubmissionsService.mark_opened( submission, request.user, send_slack_notification=False) filename, pdf_bytes = get_printout_for_submission( request.user, submission) response = HttpResponse(pdf_bytes, content_type='application/pdf') response['Content-Disposition'] = 'filename="{}"'.format(filename) return response
def dispatch(self, request, submission_id, *args, **kwargs): self.next_url = request.GET.get( 'next', reverse_lazy('intake-app_index')) self.author = request.user self.from_organization = request.user.profile.organization self.to_organization = \ request.user.profile.organization.transfer_partners.first() submission_id = int(submission_id) self.submission = models.FormSubmission.objects.get( id=submission_id) self.application = self.submission.applications.filter( organization=self.from_organization).first() if not self.to_organization or not self.application: return not_allowed(request) return super().dispatch(request, *args, **kwargs)
def get(self, request, bundle_id): bundle = get_object_or_404(models.ApplicationBundle, pk=int(bundle_id)) has_access = request.user.profile.should_have_access_to(bundle) if not has_access: return not_allowed(request) submissions = list( request.user.profile.filter_submissions(bundle.submissions.all())) forms = [ submission.get_display_form_for_user(request.user) for submission in submissions ] context = dict(bundle=bundle, forms=forms, count=len(submissions), show_pdf=bool(bundle.bundled_pdf), app_ids=[sub.id for sub in submissions], bundled_pdf_url=bundle.get_pdf_bundle_url()) BundlesService.mark_opened(bundle, request.user) return TemplateResponse(request, "app_bundle.jinja", context)
def get(self, request, bundle_id): bundle = get_object_or_404(models.ApplicationBundle, pk=int(bundle_id)) has_access = request.user.profile.should_have_access_to(bundle) if not has_access: return not_allowed(request) submissions = list( request.user.profile.filter_submissions(bundle.submissions.all())) forms = [ submission.get_display_form_for_user(request.user) for submission in submissions] context = dict( bundle=bundle, forms=forms, count=len(submissions), show_pdf=bool(bundle.bundled_pdf), app_ids=[sub.id for sub in submissions], bundled_pdf_url=bundle.get_pdf_bundle_url()) BundlesService.mark_opened(bundle, request.user) return TemplateResponse(request, "app_bundle.jinja", context)
def check_for_scope_based_redirects(self): """Override in child classes to redirect requests based on instance properties. """ if not self.application: return not_allowed(self.request)