from django.shortcuts import render, redirect
from django.contrib import messages
from .forms import UserRegisterForm
from django.contrib.auth.decorators import login_required
from blog.models import Jobseekers

# Create your views here.
def register(request): 
    if request.method == 'POST':
        form = UserRegisterForm(request.POST)
        if form.is_valid():
            form.save()
            username = form.cleaned_data.get('username')
            messages.success(request, 'Account created!')
            return redirect('login')
    else:
        form = UserRegisterForm()
    return  render(request, 'users/register.html', {'form': form})
def profile(request):
    return render(request, 'users/profile.html')

def profile(request):
    jobseek = Jobseekers.objects.all()
    print(jobseek)
    context = {'jobseeker': jobseek}
    return render(request, 'users/profile.html', context)