Commit 79b2a22e authored by Andre Matthew Dumandan's avatar Andre Matthew Dumandan 😴

Deleted unnecessary function in Homepage views.py

parent c3d08467
from django.shortcuts import render,redirect from django.shortcuts import render,redirect
from django.template import loader from django.template import loader
from django.http import HttpResponse from django.http import HttpResponse
from .models import WidgetUser,Department from .models import WidgetUser
from django.views.generic.edit import CreateView from django.views.generic.edit import CreateView
from django.views.generic import View from django.views.generic import View
...@@ -27,10 +27,3 @@ class WidgetUserCreateView(CreateView): ...@@ -27,10 +27,3 @@ class WidgetUserCreateView(CreateView):
if form.is_valid(): if form.is_valid():
new_user = form.save() new_user = form.save()
return redirect("homepage:widgetuser_add") return redirect("homepage:widgetuser_add")
\ No newline at end of file
#Uses the built-in context function to create a selection of department objects for the form
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["departments"] = Department.objects.all()
return context
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