Commit 85d51030 authored by Charles Lim's avatar Charles Lim

Added a new cbv to homepage for forms

parent 751bfbfe
...@@ -21,3 +21,16 @@ ...@@ -21,3 +21,16 @@
background-position: -100% 0; background-position: -100% 0;
color: white; color: white;
} }
.new-user-link {
text-decoration: none;
font-family: Oxygen;
color: black;
font-size: 26px;
padding: 10px;
width: fit-content;
transition: 0.2s ease-in-out;
}
.new-user-link:hover {
background-color: rgba(0, 0, 0, 0.8);
color: white;
}
\ No newline at end of file
...@@ -16,4 +16,5 @@ Welcome to Widget! ...@@ -16,4 +16,5 @@ Welcome to Widget!
{% for user in all_widgetusers %} {% for user in all_widgetusers %}
<a class="details" href="{{user.id}}/details">{{forloop.counter}}. {{user.last_name}}, {{user.first_name}} {{user.middle_name}}</a> </br> <a class="details" href="{{user.id}}/details">{{forloop.counter}}. {{user.last_name}}, {{user.first_name}} {{user.middle_name}}</a> </br>
{% endfor %} {% endfor %}
<a class="new-user-link" href="users/add">Add Widget User</a>
{% endblock %} {% endblock %}
\ No newline at end of file
<!-- homepage/widgetuser_form.html -->
{% extends 'base.html' %}
{% load static %}
{% block title %}Homepage{% endblock %}
{% block styles %}
<link rel="stylesheet" href="{% static 'homepage/widgetuser_form.css' %}">
{% endblock %}
{% block header %}
Add Widget User
{% endblock %}
{% block content %}
<p> Student ID: {{object.id_num}}</p>
<p> Email: {{object.email}}</p>
<p> Department and Course: {{object.department.home_unit}}, {{object.department.dept_name}}</p>
{% endblock %}
\ No newline at end of file
from tkinter import Widget
from django.shortcuts import render from django.shortcuts import render
from django.views import View from django.views import View
from django.views.generic.detail import DetailView from django.views.generic.detail import DetailView
from .models import Department, WidgetUser from django.views.generic.edit import CreateView
from .models import WidgetUser
# Homepage Index View
class HomepageView(View): class HomepageView(View):
def get(self, request): def get(self, request):
objects_set = { objects_set = {
...@@ -11,6 +13,10 @@ class HomepageView(View): ...@@ -11,6 +13,10 @@ class HomepageView(View):
} }
return render(request, 'homepage/index.html', objects_set) return render(request, 'homepage/index.html', objects_set)
# WidgetUser Detail View
class WidgetUserDetailView(DetailView): class WidgetUserDetailView(DetailView):
model = WidgetUser model = WidgetUser
# WidgetUser Create View
class WidgetUserCreateView(CreateView):
model = WidgetUser
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment