예제 #1
0
 def post(self, **kwargs):
     if not self.auth_current_user.is_admin and not self.auth_current_user.is_staff:
         return redirect(url_for('auth/login'))       
     if self.request.form.get('invoiceid'):
         invoice = InvoiceModel.get(self.request.form.get('invoiceid'))
         invoice.Paid = True
         invoice.put()       
         jobs = JobModel.all()
         jobs.filter("Invoice = ", invoice)
         for job in jobs: 
             job.OrderStage = OrderStatus.Paid
             job.put()
         
         context = {'invoiced': True }
         if self.request.is_xhr:
             return render_json_response(context)
예제 #2
0
 def get(self, **kwargs):
     if not self.auth_current_user.is_admin and not self.auth_current_user.is_staff:
         return redirect(url_for('auth/login'))
     invoiceid = kwargs['invoiceid']
     jobs = JobModel.all()
     jobs.filter("Invoice = ", InvoiceModel.get(invoiceid))
     context = []
     if self.request.is_xhr:
         for job in jobs:
             context.append({
                             'name' : job.Nickname, 
                             'jobstage': lstJobStages[job.JobStage], 
                             'orderstage': lstOrderStages[job.OrderStage], 
                             'id' : str(job.key()), 
                             'created': job.Created.strftime("%b %d %Y"), 
                             'quote' : job.Quote 
                             });
         return render_json_response(context)
     else:
         return render_response('hello.html', **context)