예제 #1
0
def create_batch(request, project_id, stage_id, template="create_project.html"):
    form = BatchForm(request.POST or None)
    if request.method == "POST" and form.is_valid():
        new_project = form.save()
        print new_project
        return redirect("enterprise.project.stage", project_id=project_id)
    context = {"form": form, "title": _("Create Batch")}
    return render(request, template, context)
예제 #2
0
 def post(self, request, *args, **kwargs):
     print request.POST
     if request.POST['etype'] == 'batch':
         form = BatchForm(request.POST)
         batch = form.save(commit=True)
         return HttpResponseRedirect('/admin/batch')
     if request.POST['etype'] == 'division':
         form = BatchDivisionForm(request.POST)
         div = form.save(commit=True)
         return HttpResponseRedirect('/admin/batch/#batch-div-add')
예제 #3
0
파일: views.py 프로젝트: maheshcn/leadlive
 def post(self, request, *args, **kwargs):
     print request.POST
     if request.POST['etype']=='batch':
         form=BatchForm(request.POST)
         batch = form.save(commit=True)
         return HttpResponseRedirect('/admin/batch')
     if request.POST['etype']=='division':
         form=BatchDivisionForm(request.POST)
         div = form.save(commit=True)
         return HttpResponseRedirect('/admin/batch/#batch-div-add')
예제 #4
0
파일: views.py 프로젝트: maheshcn/leadlive
 def post(self, request, *args, **kwargs):
     try:
         instance = Batch.objects.get(id=request.POST['bid'])
         form=BatchForm(request.POST,instance=instance)
         batch = form.save(commit=False)
         #user = User.objects.create_user(student.admission_no,student.email, 'johnpassword')
         #user.first_name=student.name
         #user.save()
         batch.save()
         msg="Record saved"
     except:
         msg="Unable to process, Please check all values are present"
     return HttpResponse(json.dumps(dict(result=msg)), content_type="application/json")
예제 #5
0
 def post(self, request, *args, **kwargs):
     try:
         instance = Batch.objects.get(id=request.POST['bid'])
         form = BatchForm(request.POST, instance=instance)
         batch = form.save(commit=False)
         #user = User.objects.create_user(student.admission_no,student.email, 'johnpassword')
         #user.first_name=student.name
         #user.save()
         batch.save()
         msg = "Record saved"
     except:
         msg = "Unable to process, Please check all values are present"
     return HttpResponse(json.dumps(dict(result=msg)),
                         content_type="application/json")
예제 #6
0
 def get(self, request, *args, **kwargs):
     batch_form = BatchForm()
     div_form = BatchDivisionForm()
     print div_form
     return render(request, self.template_name, {
         'batch_form': batch_form,
         'div_form': div_form
     })
예제 #7
0
    def get(self, request, *args, **kwargs):
        _batch_id = args[0]
        batchObj = Batch.objects.filter(id=_batch_id)
        batch = batchObj.values()[0]
        batch['bid'] = batchObj[0].id
        batch['start_date'] = batchObj[0].start_date.strftime('%d/%m/%y')
        batch['end_date'] = batchObj[0].end_date.strftime('%d/%m/%y')
        batch['etype'] = 'batch'
        form = BatchForm(batch)
        print form

        return render(request, self.template_name, {'form': form})