from multiprocessing import context
from django.shortcuts import render
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView
from .models import WidgetUser

def index(request):
    user_list = WidgetUser.objects.order_by("last_name")
    context = {
        "user_list": user_list
    }

    return render(request, "homepage/index.html", context)

class UserDetailView(DetailView):
    model = WidgetUser

class UserCreateView(CreateView):
    model = WidgetUser
    fields = ['last_name', 'first_name', 'middle_name', 'id_num', 'email', 'department', 'image']