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.template import loader
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 import View
......@@ -26,11 +26,4 @@ class WidgetUserCreateView(CreateView):
def form_valid(request,form):
if form.is_valid():
new_user = form.save()
return redirect("homepage:widgetuser_add")
#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
return redirect("homepage:widgetuser_add")
\ 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