Params
what is params
params
we get as parameter in view.
which is an object of Params
class
In which we get all the values
extracted from url
in the form of variables
. These variables can also be get
,add
, delete
, update
in the following ways.
This would be useful in middlewares in general.
Add variable to params
Get variable from params
variable access from params
get()
method.
In get method we have to give the name
of the variable in the form of string
.
If the variable exists then it will return the value
otherwise it will return None
.
Updating variable in params
If a variable named stu_id
does not exist in params
, a new variable named stu_id
will be created.
Delete variable from params
deleting a variable using the del
keyword
delete()
method.
In the delete()
method, you have to pass the name
of the variable as a string
. It will not give an error if a variable with this name does not exist in params
.