def new_task(request): form = TaskForm(request.POST or None) if form.is_valid(): form.save() return redirect('home') return render(request, 'new_task.html', {'form': form})
def home(request): task_list = Task.objects.filter(parent=None) form = TaskForm(request.POST or None) if form.is_valid(): form.save() return render(request, 'home.html', locals())