Example #1
0
def add_codingjob(request, project):
    form = AddCodingJob.options_form(data=request.POST or None, project=project, initial=dict(insertuser=request.user))
    convert_to_jquery_select(form)
    form.fields["insertuser"].widget = forms.HiddenInput()
    if form.is_valid():
        result = AddCodingJob.run_script(form)
        if isinstance(result, CodingJob): result = [result]
        request.session['added_codingjob'] = [job.id for job in result]
        return redirect(reverse("project-codingjobs", args=[project.id]))
        
    ctx = locals()
    ctx['menu'] = PROJECT_MENU
    ctx['title'] = 'codingjob'
    ctx['context'] = project
    return render(request, 'navigator/project/add.html', ctx)
Example #2
0
def add_codingjob(request, project):
    form = AddCodingJob.options_form(data=request.POST or None,
                                     project=project,
                                     initial=dict(insertuser=request.user))
    convert_to_jquery_select(form)
    form.fields["insertuser"].widget = forms.HiddenInput()
    if form.is_valid():
        result = AddCodingJob.run_script(form)
        if isinstance(result, CodingJob): result = [result]
        request.session['added_codingjob'] = [job.id for job in result]
        return redirect(reverse("project-codingjobs", args=[project.id]))

    ctx = locals()
    ctx['menu'] = PROJECT_MENU
    ctx['title'] = 'codingjob'
    ctx['context'] = project
    return render(request, 'navigator/project/add.html', ctx)
Example #3
0
 def get_form(self, form_class):
     form = super(CodingJobAddView, self).get_form(form_class)
     form.fields['insertuser'].initial = self.request.user
     form.fields["insertuser"].widget = forms.HiddenInput()
     convert_to_jquery_select(form)
     return form
Example #4
0
 def get_form(self, form_class):
     form = super(CodingJobAddView, self).get_form(form_class)
     form.fields['insertuser'].initial = self.request.user
     form.fields["insertuser"].widget = forms.HiddenInput()
     convert_to_jquery_select(form)
     return form