1👍
✅
reverse()
won’t generate query params. You can just try the string formatting as
path = reverse('admin:app_model_changelist')
result = '%s?id__in=%s' % (path, ','.join(map(str,list_of_ids)))
👤JPG
1👍
Using kwargs
you will have to provide a dictionary with the named arguments, as specified in your URL configuration.
Try instead to use args
, like described in the django documentation on resolve()
:
If the URL accepts arguments, you may pass them in args. For example:
from django.urls import reverse def myview(request): return HttpResponseRedirect(reverse('arch-summary', args=[1945]))
- [Django]-Django raw SQL query – looping over result, it executes a query for every iteration
- [Django]-Django – download file without reloading the page
- [Django]-'method' object is not iterable from calling splitlines from a read method
Source:stackexchange.com