def get(self, request, *args, **kwargs): form = addTodoListForm() projects = MainProject.objects.all() data = { 'form': form, 'projects': projects, } return render(request,self.template_name,data)
def post(self,request,*args,**kwargs): form = addTodoListForm(request.POST) projects = MainProject.objects.all() todolists = todolistmodel.objects.all() data = { 'form': form, 'projects': projects, 'todolists': todolists, } if form.is_valid(): form.save(commit=True) return render(request,self.template_name,data) else: return render(request,self.template_name,data)