Removed commented code in views.py of the dashboard app

parent 5940d495
from django.shortcuts import render
from django.http import HttpResponse
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, UpdateView
from .models import Department, WidgetUser
def dashboard(request):
widgetusers = WidgetUser.objects.all()
response = "Welcome to Widget!<br><br>WIDGET USERS:<br>"
for user in widgetusers:
response += "{}, {} {}: {}, {}<br>".format(
user.last_name,
user.first_name,
user.middle_name,
user.department,
user.department.home_unit
)
return HttpResponse(response)
\ No newline at end of file
return render(request, 'dashboard/dashboard.html', {'WidgetUser': WidgetUser.objects.all()})
class WidgetuserDetailView(DetailView):
model = WidgetUser
template_name ='dashboard/widgetuser-details.html'
fields = '__all__'
class WidgetuserCreateView(CreateView):
model = WidgetUser
fields = '__all__'
template_name ='dashboard/widgetuser-add.html'
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