Commit 4aa2dfa5 authored by Almira Redoble's avatar Almira Redoble

Implemented edit widget user page. Created UserUpdateView in views.py that...

Implemented edit widget user page. Created UserUpdateView in views.py that also accepts UserForm into the attribute form_class. Configured url for the said view in urls.py and created widgetuser-edit.html
parent 39e509fa
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Widget User{% endblock %}
{% block heading %}Edit Widget User:{% endblock %}
{% block content %}
{{ form.non_field_errors }}
<form action="{% url 'dashboard:user-edit' pk=object.pk %}" method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Save Changes to Widget User" class="btn">
</form>
{% endblock %}
\ No newline at end of file
from django.urls import path
from .views import index, UserDetailView, UserCreateView
from .views import index, UserDetailView, UserCreateView, UserUpdateView
urlpatterns = [
path('dashboard/', index, name='index'),
path('widgetusers/<int:pk>/details/', UserDetailView.as_view(), name='user-details'),
path('widgetusers/add/', UserCreateView.as_view(), name='user-add'),
path('widgetusers/<int:pk>/edit/', UserUpdateView.as_view(), name='user-edit'),
]
......
......@@ -18,3 +18,8 @@ class UserCreateView(CreateView):
model = WidgetUser
form_class = UserForm
template_name = 'dashboard/widgetuser-add.html'
class UserUpdateView(UpdateView):
model = WidgetUser
form_class = UserForm
template_name = 'dashboard/widgetuser-edit.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