django / django/new-features

Add block for home in admin breadcrumbs

Open
#86 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
188
Forks
7
PR merge metrics
No merged PRs in 30d

Description

### Code of Conduct

- [x] I agree to follow Django's Code of Conduct

### Feature Description

The "Home" link is repeated in the breadcrumbs block of many admin templates. There are sometimes other links that are repeated as well. I propose that the "Home" link (at least) be wrapped in a block and reused.

### Problem

One advantage is that it would be better from a DRY perspective. Another reason is something that I have needed to do: change breadcrumbs such that the site root URL is shown in the breadcrumbs as "Home" and the admin index page (the usual "Home" link) is shown as a link in the breadcrumbs after "Home". At present, this involves overriding the breadcrumbs block in every admin template. It would be much better if this could be changed in a single place.

### Request or proposal

proposal

### Additional Details

I came across the work being done in https://github.com/django/django/pull/19492 to support https://code.djangoproject.com/ticket/34041 . The work there looks great - I hope it gets wrapped up and merged. After reading through the changes, I thought that this idea was sufficiently different to warrant a separate issue.

My thought is that this is a minimal change that should be backwards compatible. Given that the breadcrumbs would change with the aforementioned PR, perhaps it would be best to release these changes together. This change could be added there, or added in a PR shortly after for the same Django release.

Happy to help on a PR, if that should be separate from PR 19492. Please let me know what you think!

### Implementation Suggestions

Examples here are based on PR 19492 . In `base.html`, do this:

```html
{% block breadcrumbs %}


{% endblock %}
```

For other templates (e.g. `change_list.html` here), call `super`:

```html
{% block breadcrumbs %}


{% endblock %}
```

With this approach, I believe that the home link can be changed once, e.g. in `base_site.html`, and impact all admin pages. Additional child page links could also be appended to the `breadcrumb-root` block for any templates where it makes sense to inherit them in a child template.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.