def load_example_grid(request): """Clears the Designer and loads the example grid with the given name.""" if request.method == 'POST': form = ExampleGridsForm(request.POST) if form.is_valid(): example_name = form.cleaned_data['grid'] if example_name == 'empty': smartgrid_mgr.clear_designer() else: smartgrid_mgr.load_example_grid(example_name) response = HttpResponseRedirect("/sgg_designer/") return response
def load_example_grid(request, draft_slug): """Clears the Designer and loads the example grid with the given name.""" draft = smartgrid_mgr.get_designer_draft(draft_slug) if request.method == 'POST': form = ExampleGridsForm(request.POST) if form.is_valid(): example_name = form.cleaned_data['grid'] if example_name == 'empty': smartgrid_mgr.clear_designer(draft) else: smartgrid_mgr.load_example_grid(draft, example_name) response = HttpResponseRedirect("/sgg_designer/?draft=%s" % draft.slug) return response