def get(self, request, submission_id): self.submissions = list( SubmissionsService.get_permitted_submissions( request.user, [submission_id])) if not self.submissions: return not_allowed(request) return super().get(request, submission_id)
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) filename, pdf_bytes = PDFService.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): if request.user.profile.should_see_pdf() and not request.user.is_staff: return redirect( reverse_lazy('intake-filled_pdf', kwargs=dict(submission_id=submission_id))) self.submissions = list( SubmissionsService.get_permitted_submissions( request.user, [submission_id])) if not self.submissions: return not_allowed(request) return super().get(request, submission_id)
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) filename, pdf_bytes = PDFService.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): 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 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 request.user.is_staff: if not submission.organizations.filter( id=request.user.profile.organization_id).exists(): return not_allowed(request) apps = AppsService.filter_to_org_if_not_staff( submission.applications.all(), request.user) AppsService.handle_apps_opened(self, apps) filename, pdf_bytes = PDFService.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, submission_id): submission = get_object_or_404(models.FormSubmission, pk=int(submission_id)) if not request.user.is_staff: if not submission.organizations.filter( id=request.user.profile.organization_id).exists(): return not_allowed(request) apps = AppsService.filter_to_org_if_not_staff( submission.applications.all(), request.user) AppsService.handle_apps_opened(self, apps) filename, pdf_bytes = PDFService.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, 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 = [ DisplayFormService.get_display_form_for_user_and_submission( request.user, submission) 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 = [ DisplayFormService.get_display_form_for_user_and_submission( request.user, submission) 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 dispatch(self, request, *args, **kwargs): if not request.user.is_staff: return not_allowed(request) else: return super().dispatch(request, *args, **kwargs)
def get(self, request, submission_id): self.submissions = list(SubmissionsService.get_permitted_submissions( request.user, [submission_id])) if not self.submissions: return not_allowed(request) return super().get(request, submission_id)
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)