3👍
✅
You simply can add another on the back like http://127.0.0.1:8000/call/add/1/foo/2
. You have to add the second parameter to the regular expression as well like (r'^call/add/(?P<call_id>\d+)/foo/(?P<foo_id>\d+)$', call_view),
.
You have to change the controller as well: def call_view(request, call_id, foo_id):
2👍
You can specify multiple parameters as follows:
(r'^call/add/(?P<call_id>\d+)/(?P<other_value>\d+)/$', call_view),
and you view should look like this:
def call_view(request, call_id, other_value):
# view code here
- [Django]-Stop celery task from django admin panel
- [Django]-How to set User in request.user in Django using MongoDB
2👍
(r'^call/add/(?P<call_id>\d+)/(?P<receiver_id>\d+)/$', call_view),
http://127.0.0.1:8000/call/add/1/903256
and you need to add def call_view(request, call_id, receiver_id):
in views.py
or you can you w+
instead of d+
to pass string a a variable
(r'^call/add/(?P<call_id>\d+)/(?P<receiver_name>\w+)/$', call_view),
http://127.0.0.1:8000/call/add/1/Kave
For more info : https://docs.djangoproject.com/en/dev/topics/http/urls/
- [Django]-How to set Value of One field of Django model equal to Other field of other Django model
- [Django]-Django – Slugify get lookup
- [Django]-Django admin raw_id_fields table display
- [Django]-Using absolute function in Django query set order by clause
- [Django]-Django annotate multiple objects based on multiple fields on a M2M relationship
Source:stackexchange.com