def configuration_page(request, template='configuration.html'): if request.method == 'POST': configuration_form = ConfigurationForm(request.POST) if configuration_form.is_valid(): set_session_with_attributes(configuration_form, request) return HttpResponseRedirect('/getbuilds/') else: configuration_form = ConfigurationForm() return render(request, template, {'configuration_form': configuration_form, })
def updateConfiguration(request, key): if not admin(): return HttpResponseRedirect(users.create_login_Configuration('/blogs')) form = ConfigurationForm(request.POST) if form.is_valid(): configuration = Configuration.get(key) configuration.title = form.cleaned_data['title'] configuration.motto = form.cleaned_data['motto'] configuration.put() return HttpResponseRedirect('/blogs') else: return editConfiguration(request, key)
def createConfiguration(request): if not admin(): return HttpResponseRedirect(users.create_login_Configuration("/blogs")) form = ConfigurationForm(request.POST) if form.is_valid(): configuration = Configuration() configuration.title = form.cleaned_data["title"] configuration.motto = form.cleaned_data["motto"] configuration.pagesize = form.cleaned_data["pagesize"] configuration.put() return HttpResponseRedirect("/blogs") else: return newConfiguration(request)
def build_project(request, object_id): project = get_object_or_404(Project, id=object_id) if project.project_builder == PROJECT_BUILDER_DJANGO: # Create variables builder = DjangoBuilder(project) if request.method == 'POST': form = ConfigurationForm(project, request.POST) if form.is_valid(): builder.build() return TemplateResponse(request, 'core/build_success.html', {'project': project}) else: form = ConfigurationForm(project) return TemplateResponse(request, 'core/build.html', {'form': form, 'project': project})