#11727 closed (wontfix)
Breadcrumbs contrib app
Reported by: | Felipe 'chronos' Prenholato | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.1 |
Severity: | Keywords: | breadcrumbs, flatpages | |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This patches add support of easy-to-use breadcrumbs, that can be set on any view (including generic views) and used on templates to build a breadcrumb list.
Today Django not have a breadcrumbs system, but it is a common necessary item in various websites, so I think that is a good idea to attach it to framework as contrib app.
Breadcrumb crontrib app
Breadcrumb app are composed of two basic classes that maintain a list of 'registered' breadcrumbs and one middleware class.
Middleware class add breadcrumbs attribute to request object and user can access trough request.breadcrumbs.
User easily add breadcrumbs in tree ways:
# one by one request.breadcrumbs( name, url ) # various tuples/lists request.breadcrumbs( ( (name1, url1), (name2, url2), (name3, url3), ...,) ) request.breadcrumbs( [name1, url1], [name2,url2], [name3,url3], ...] ) # objects with attributes name and url in list / tuple format: request.breadcrumbs( ( obj1, obj2, obj3, obj4, ......) ) request.breadcrumbs( [ obj1, obj2, obj3, obj4, ......] )
and after can iterate over request.breadcrumbs to get each one, in order that added:
{% for breadcrumb in request.breadcrumbs %} <a href="{{ breadcrumb.url }}">{{ breadcrumb.name }}{% if not forloop.last %} >> {% endif %}</a> {% endfor %}
FlatPages patch
With attached FlatPages patch, we can have breadcrumbs added, automatically for any FlatPage with support for N levels urls.
Breadcrumbs repository
When build this app I setup a Google Code page and repository, so, for anyone that want to contribute or request changes, here is page: http://code.google.com/p/django-breadcrumbs/
Attachments (4)
Change History (8)
by , 15 years ago
Attachment: | contrib.breadcrumbs.diff added |
---|
by , 15 years ago
Attachment: | contrib.flatpages.views.py.diff added |
---|
FlatPages patch to support breadcrumbs.
comment:1 by , 15 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
a) Please provide one diff from the root of the django tree.
b) Something like this should definitely be discussed on the django-developers mailing list.
comment:2 by , 15 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
No - what this needs is to live in the wild for a while.
The current policy with contrib apps is that we're going to integrate from the wild. Rather than try to invent best practice ourself, we're going to let the community decide what tools and techniques are important, and pick the best ones to integrate with the trunk.
Breadcrumbs may well be a good contribution to contrib, but if you want to prove your case, you need to release this as a public external project and demonstrate significant community support both for your idea, and for your implementation.
Marking wontfix for now, but this doesn't preclude reopening this ticket later when the concept has been proven.
by , 15 years ago
Attachment: | breadcrumbs_svn.diff added |
---|
Breadcrumbs diff based on rev. 11477 from trunk.
comment:3 by , 15 years ago
Thank you!
I probably want to move naming breadcrumbs to urls.py of each project, but without leave option of user add breadcrumbs in views because generic views and flatpages views, so, I plan to use breadcrumbs urls.py like this code snippet:
url(r'^$','views.home',name='home',breadcrumb=_("Home")),
So, I really like sugestions, etc. I'm a little out of code these weeks because I'm moving from city, but when back I want to make changes in breadcrumbs.
The breadcrumbs system.