Exemplo n.º 1
0
 def post(self, *args, **kwargs):
     request = args[0]
     form = SupervisionDocumentForm(request.POST, request.FILES)
     if form.is_valid():
         supervision_document = SupervisionDocument(
             name=form.cleaned_data['document'].name,
             document=base64.b64encode(
                 form.cleaned_data['document'].read()),
             data_type=form.cleaned_data['document'].content_type,
             domain=self.domain)
         supervision_document.save()
     return HttpResponseRedirect(reverse(self.urlname, args=[self.domain]))
Exemplo n.º 2
0
 def post(self, *args, **kwargs):
     request = args[0]
     form = SupervisionDocumentForm(request.POST, request.FILES)
     if form.is_valid():
         supervision_document = SupervisionDocument(
             name=form.cleaned_data['document'].name,
             document=base64.b64encode(form.cleaned_data['document'].read()),
             data_type=form.cleaned_data['document'].content_type,
             domain=self.domain
         )
         supervision_document.save()
     return HttpResponseRedirect(
         reverse(self.urlname, args=[self.domain])
     )
Exemplo n.º 3
0
 def main_context(self):
     main_context = super(SupervisionDocumentListView, self).main_context
     main_context.update({
         'form': SupervisionDocumentForm(),
         'documents': SupervisionDocument.objects.filter(domain=self.domain),
         'is_user_domain_admin': self.request.couch_user.is_domain_admin(self.domain),
         'report_links': self.report_links
     })
     return main_context