Url parameters passed in two ways:
1. " the Login / <a> / <b> / " in the url 2. After you submit the operation trigger back: "login / a = xxx & b = xxx /?"
The first:
example:
There are the urls in
urlspattern=[path("login/"),views.index,name='log',path("blabla/<a>/<b>/",views.bla,name='bla')]
Corresponding index function in the views:
def index(request): return(reserve('bla'))
So the question is: I call name is how to pass parameters into it when the function of the bla?
Solution
# Tuple (tuple) transmission parameters: Reserve ( ' BLA ' , kwargs ( ' AAA ' , ' BBB ' )) # must be written in accordance with the order ab! ! ! # Dictionary parameter passing: Reserve ( ' BLA ' , {B: ' BBB ' , A: " AAA " }) # notes unnecessary sequence
The second:
Such as the use <a> tag in the page:
<a href="{% url 'bla' %}">
The question then it came again: how to pass parameters?
Solution:
<a href="{% url 'bla' a='aaa' b='bbb' %}">
Direct write just fine.