Пример #1
0
def add(request, project_id):
    project = Project.objects.get(pk=project_id)
    if request.method == 'POST':
        form = SprintForm(request.POST)
        if form.is_valid():
            sprint = form.save(False)
            sprint.project = project
            sprint.save()
            request.user.message_set.create(message="New sprint has been added.")
            return HttpResponseRedirect('/sprint/show/' + str(sprint.id))
    else:
        form = SprintForm()
    return render_to_response('sprint/add.html', {'form': form, 'project': project}, context_instance=RequestContext(request))