Closed mark0978 closed 10 years ago
I'll check that later today and push a fix if needed. Thanks
Can you test latest code from github? If it works I'll push new version to pypi. Thanks
I'll test it tonight.
This no longer throws an error, but this does not render any breakcrumbs
{% block breadcrumbs %}
{% breadcrumb customer 'customer-details' cust_id=customer.id %}
{% breadcrumb customer 'contact-details' cust_id=customer.id contact_id=contact.id %}
{% endblock %}
{% block content %}
bc{% render_breadcrumbs %}cb
...
{% endblock content %}
renders like
The inspector shows it like:
can you retry with latest code from github?
if it still doesn't work please paste contact-details
and urls.py for it (only view definition, not full code), maybe I'm missing test case for it
Ok, the problem is one of documentation. Notice above how I have two blocks, one for breadcrumbs
and one for content
, you can't do that because you don't know which order the blocks will be rendered in. The docs need to say do all of it inline in one block like this:
{% breadcrumb customer 'customer-details' cust_id=customer.id %}
{% breadcrumb customer 'contact-details' cust_id=customer.id contact_id=contact.id %}
{% render_breadcrumbs %}
This works as expected. I had to go thru the debugger to understand what was happening, but it really was this simple.
The kwargs problem was a real problem, this last issue was just documentation that wasn't explicit enough.
Even though the blocks were in the right order in this template, they were in a different order in the site base template and therefore they rendered incorrectly. In my case breadcrumbs were added AFTER they had been rendered.
{% breadcrumb customer 'customer-details' cust_id=customer.id %}
TemplateSyntaxError at /customers/edit-contact/2/3/ 'breadcrumb' received unexpected keyword argument 'cust_id'
Since you were using reverse, I would have expected it to allow for kwargs as well as positional args.