因此,我已经安装了Django allauth来处理我的登录身份验证。但是,我不需要单独的URL进行登录。我希望它可以通过Javascript onclick在我的主页上显示(单击按钮/不刷新页面时会出现登录框)。但是当前的allauth URL位于“ / accounts / login”。因此,正如我所说,我需要将其放在'/'处。我该怎么做?
这是我的views.py:
def boxes_view(request):
...
search = request.GET.get('search')
posts = Post.objects.all().filter(category=1).order_by('-date')
if search:
posts = posts.filter(
Q(title__icontains=search) |
Q(content__icontains=search)
)
else:
posts = Post.objects.all().filter(category=1).order_by('-date')
context = {
'posts': posts,
}
return render(request, 'polls.html', context)
我可以将其作为上下文传递吗?怎么做?
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句