from django.shortcuts import render
from .models import Task, Request

def home(request):
    tasks = Task.objects.all()
    return render(request, 'core/home.html', {'tasks': tasks})

def task_detail(request, task_id):
    task = Task.objects.get(id=task_id)
    return render(request, 'core/task_detail.html', {'task': task})

def create_request(request, task_id):
    if request.method == 'POST':
        # logic to create a new Request
        pass
    else:
        task = Task.objects.get(id=task_id)
        return render(request, 'core/create_request.html', {'task': task})

def why_it_works(request):
    return render(request, 'core/why_it_works.html')


