我正在尝试解决与该错误有关的一个问题
“组匹配查询不存在。”
但是无处可去,解决问题变得更加棘手,需要帮助!?
我已经在Settings.py中尝试过SITE_ID = 1,但是什么也没发生
Views.py:=
from django.shortcuts import render
from django.views.generic import TemplateView
from django.http import HttpResponseRedirect
from django.contrib import auth
from django.template.context_processors import csrf
from django.contrib import messages
# Create your views here.
def user_login(request):
if request.user.is_authenticated:
messages.add_message(request, messages.INFO, 'You are already
Logged in.')
return HttpResponseRedirect('/home')
else:
c = {}
c.update(csrf(request))
return render(request, 'loginmodule/login.html',{})
context_processors.py:=
from django.contrib.auth.models import Group
def hasGroup(user, groupName):
group = Group.objects.get(name=groupName)
return True if group in user.groups.all() else False
def menu_processor(request):
menu = {}
user = request.user
if hasGroup(user, 'Consultant'):
menu['Appointments'] = '/appointment