Пример #1
0
def home(request):
    if request.POST:
        form = CreateWireframeForm(request.POST)
        if form.is_valid():
            wireframe = form.save()
            return HttpResponseRedirect(reverse('wireframes-edit',
                    args=[wireframe.id]))
    else:
        form = CreateWireframeForm()
    return render_to_response('wireframes/home.html',
        RequestContext(request, locals()))
Пример #2
0
def create(request, project_id):
    project = Project.objects.get(pk=int(project_id))
    wireframe = Wireframe(author=request.user, project=project)
    if request.POST:
        form = CreateWireframeForm(request.POST, instance=wireframe)
        if form.is_valid():
            wireframe = form.save()
            return HttpResponseRedirect(reverse('wireframes-edit',
                args=None, kwargs={"project_id":int(wireframe.project.id),
                "wireframe_id":int(wireframe.id)}))
    else:
        form = CreateWireframeForm(instance=wireframe)
    return render_to_response('wireframes/create.html',
        RequestContext(request, locals()))