コード例 #1
0
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
コード例 #2
0
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
コード例 #3
0
ファイル: views.py プロジェクト: csdl/makahiki
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