Closed chromium7 closed 1 year ago
This error occurs when one of the kwargs
parameter is named items
.
In this case, when django reads job.kwargs.items
in the template, kwargs["items"]
is the one being called instead of kwargs.items()
, producing an error if kwargs["items"]
cant be unpacked.
This issue can be easily replicated, simply pass a dictionary with items
as a key into a template context, and iterate the dictionary in the template
# views.py
def ...:
context = {'kwargs': {'items': 1}}
return render(request, 'template.html', context)
<!-- template.html -->
{% for key, value in kwargs.items %}
{% endfor %}
job detail
page sometimes return an error when being openederror:
This probably is the one causing the error, will investigate more on why the error occured https://github.com/rq/django-rq/blob/a800c2448294981c3c10187a9faad6a87f55793e/django_rq/templates/django_rq/job_detail.html#L141-L145