Commit b06aba32 authored by Mavrick Jordan Lee's avatar Mavrick Jordan Lee

Added Add Widget User Page. Updated views, urls, and dashboard.html.

parent c5662e9f
...@@ -4,11 +4,15 @@ ...@@ -4,11 +4,15 @@
<h1>Welcome to Widget!</h1> <h1>Welcome to Widget!</h1>
<h2>Widget Users:</h2> <h2>Widget Users:</h2>
{% for user in widget_users %} {% for user in widget_users %}
<a href="{% url 'dashboard:widgetuser-details' user.id %}"> <a href="{% url 'dashboard:widgetuser-detail' user.id %}">
{{user.last_name}}, {{user.first_name}} {{user.last_name}}, {{user.first_name}}
</a><br> </a><br>
{% endfor %} {% endfor %}
<br><button>Add Widget User</button><br><br> <br>
<a href="{% url 'dashboard:widgetuser-add' %}">
<button>Add Widget User</button>
</a>
<br><br>
Announcement Board <br> Announcement Board <br>
Forum <br> Forum <br>
{% endblock %} {% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% block title %}Add Widget User{% endblock %}
{% block content %}
<h2>Add a new Widget user:</h2>
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
<input type="Submit" value="Add Widget User">
</form>
{% endblock %}
\ No newline at end of file
...@@ -2,12 +2,13 @@ from django.urls import path ...@@ -2,12 +2,13 @@ from django.urls import path
from . import views from . import views
from .views import ( from .views import (
WidgetUserDetailsView WidgetUserDetailsView, WidgetUserCreateView
) )
urlpatterns = [ urlpatterns = [
path('dashboard/', views.dashboard, name = "dashboard"), path('dashboard/', views.dashboard, name = "dashboard"),
path('widgetusers/<int:pk>/details/', WidgetUserDetailsView.as_view(), name = "widgetuser-details"), path('widgetusers/<int:pk>/details/', WidgetUserDetailsView.as_view(), name = "widgetuser-detail"),
path('widgetusers/add/', WidgetUserCreateView.as_view(), name = "widgetuser-add"),
] ]
app_name = 'dashboard' app_name = 'dashboard'
\ No newline at end of file
from .models import Department, WidgetUser from .models import WidgetUser
from django.shortcuts import render from django.shortcuts import render
from django.views.generic.detail import DetailView from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, UpdateView
# Create your views here. # Create your views here.
def dashboard(request): def dashboard(request):
...@@ -12,3 +13,8 @@ def dashboard(request): ...@@ -12,3 +13,8 @@ def dashboard(request):
class WidgetUserDetailsView(DetailView): class WidgetUserDetailsView(DetailView):
model = WidgetUser model = WidgetUser
template_name = 'dashboard/widgetuser-details.html' template_name = 'dashboard/widgetuser-details.html'
class WidgetUserCreateView(CreateView):
model = WidgetUser
fields = '__all__'
template_name = 'dashboard/widgetuser-add.html'
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