from django.shortcuts import render, redirect, reverse
from django.contrib.auth.decorators import login_required
from users.decorators import teacher_required
from .forms import LeaveForm
from .models import Leave
# Create your views here.


@teacher_required
@login_required
def apply_for_leave(request):
    form = LeaveForm()
    if request.method=="POST":
        if form.is_valid():
            form = LeaveForm(request.POST or None)
            form.save()
    context = {'form':form, 'title': 'Apply for leave'}
    return render(request, 'leave.html', context=context)
a5012aeee364321afcfaaca4bab4a9364493d081
<mask token>

<mask token>


@teacher_required
@login_required
def apply_for_leave(request):
    form = LeaveForm()
    if request.method == 'POST':
        if form.is_valid():
            form = LeaveForm(request.POST or None)
            form.save()
    context = {'form': form, 'title': 'Apply for leave'}
    return render(request, 'leave.html', context=context)

from django.shortcuts import render, redirect, reverse
from django.contrib.auth.decorators import login_required
from users.decorators import teacher_required
from .forms import LeaveForm
from .models import Leave


@teacher_required
@login_required
def apply_for_leave(request):
    form = LeaveForm()
    if request.method == 'POST':
        if form.is_valid():
            form = LeaveForm(request.POST or None)
            form.save()
    context = {'form': form, 'title': 'Apply for leave'}
    return render(request, 'leave.html', context=context)

from django.shortcuts import render, redirect, reverse
from django.contrib.auth.decorators import login_required
from users.decorators import teacher_required
from .forms import LeaveForm
from .models import Leave
# Create your views here.


@teacher_required
@login_required
def apply_for_leave(request):
    form = LeaveForm()
    if request.method=="POST":
        if form.is_valid():
            form = LeaveForm(request.POST or None)
            form.save()
    context = {'form':form, 'title': 'Apply for leave'}
    return render(request, 'leave.html', context=context)