Commit ffb2be43 authored by Stefan Gomez's avatar Stefan Gomez

Implemented the 'Edit Widget User Page'.

parent b6d3d47d
...@@ -7,5 +7,5 @@ ...@@ -7,5 +7,5 @@
<h3>{{ widgetuser.department.home_unit}}</h3> <h3>{{ widgetuser.department.home_unit}}</h3>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<input type="submit" value="Edit Widget User"> <a href="/dashboard/{{ widgetuser.pk }}/edit"><input type="submit" value="Edit Widget User"></a>
{% endblock %} {% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% block title %}Edit Widget User{% endblock %}
{% block content %}
<h1>Edit Widget user:</h1>
<form action="" method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Save Changes to Widget User">
</form>
{% endblock %}
{% block scripts %}
{% endblock %}
\ No newline at end of file
from django.contrib import admin from django.contrib import admin
from django.urls import path from django.urls import path
from .views import index, WidgetUserDetailView, WidgetUserCreateView from .views import index, WidgetUserDetailView, WidgetUserCreateView, WidgetUserUpdateView
urlpatterns = [ urlpatterns = [
path('', index, name='index'), path('', index, name='index'),
path('<int:pk>/details', WidgetUserDetailView.as_view(), name='widgetuser-details'), path('<int:pk>/details', WidgetUserDetailView.as_view(), name='widgetuser-details'),
path('add/', WidgetUserCreateView.as_view(), name='add-widgetuser'), path('add/', WidgetUserCreateView.as_view(), name='add-widgetuser'),
path('<int:pk>/edit', WidgetUserUpdateView.as_view(), name='edit-widgetuser'),
] ]
app_name = "dashboard" app_name = "dashboard"
\ No newline at end of file
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 from django.views.generic.edit import CreateView, UpdateView
from.models import WidgetUser from.models import WidgetUser
...@@ -19,4 +19,10 @@ class WidgetUserDetailView(DetailView): ...@@ -19,4 +19,10 @@ class WidgetUserDetailView(DetailView):
class WidgetUserCreateView(CreateView): class WidgetUserCreateView(CreateView):
model = WidgetUser model = WidgetUser
fields = '__all__' fields = '__all__'
template_name = 'dashboard/widgetuser-add.html' template_name = 'dashboard/widgetuser-add.html'
\ No newline at end of file
class WidgetUserUpdateView(UpdateView):
model = WidgetUser
fields = '__all__'
template_name = 'dashboard/widgetuser-edit.html'
\ 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