Commit 5e1d1369 authored by Gabriel G. Garrero's avatar Gabriel G. Garrero

created widgetuser-edit.html, updated views.py and urls.py to account for new...

created widgetuser-edit.html, updated views.py and urls.py to account for new edit widgetuser function
parent cf8522e9
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Widget User{% endblock %}
{% block content %}
{{ form.non_field_errors }}
{% for field in form %}
{% if field.errors %}
<p>{{ field.label }} has the following errors:</p>
<ul>
{% for error in field.errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
<h1>Edit Widget User:</h1>
<form method = "POST">
{% csrf_token %}
{{ form.as_p }}
<input type = "submit" value = "Save Changes to Widget User">
</form>
{% endblock %}
\ No newline at end of file
from django.urls import path
from .views import dashboard, WidgetUserDetailView, WidgetUserCreateView
from .views import dashboard, WidgetUserDetailView, WidgetUserCreateView, WidgetUserUpdateView
urlpatterns = [
path('', dashboard, name = 'dashboard'),
path('widgetusers/<int:pk>/details', WidgetUserDetailView.as_view(), name = 'widgetuser-details'),
path('widgetusers/add', WidgetUserCreateView.as_view(), name = "widgetuser-add"),
path('widgetusers/<int:pk>/edit', WidgetUserUpdateView.as_view(), name = "widgetuser-edit"),
]
app_name = "dashboard"
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView
from django.views.generic.edit import CreateView, UpdateView
from .models import Department, WidgetUser
......@@ -20,4 +20,9 @@ class WidgetUserDetailView(DetailView):
class WidgetUserCreateView(CreateView):
model = WidgetUser
template_name = 'dashboard/widgetuser-add.html'
fields = '__all__'
class WidgetUserUpdateView(UpdateView):
model = WidgetUser
template_name = 'dashboard/widgetuser-edit.html'
fields = '__all__'
\ No newline at end of file
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