You need to use request.GET
. So when you enter the url http://127.0.0.1:8000/menu/?tags=2&page=2
. The part after the ?
will be resulted in request.GET
.
Suppose, if your urls.py
, you have a url:
path('menu',views.function,name='function')
and in views.py
you have a function:
def function(request):
print(request.GET)
return HttpResponse('success')
In the print statement output, it will be a dictionary with keys tags
and page
with values 2
and 2
respectively
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…