Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#11727 closed (wontfix)

Breadcrumbs contrib app

Reported by: chronos 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: UI/UX:

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 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.

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)

contrib.breadcrumbs.diff (10.5 KB) - added by chronos 6 years ago.
The breadcrumbs system.
contrib.flatpages.views.py.diff (970 bytes) - added by chronos 6 years ago.
FlatPages patch to support breadcrumbs.
conf.global_settings.py.diff (480 bytes) - added by chronos 6 years ago.
Patch to global_settings.py
breadcrumbs_svn.diff (14.4 KB) - added by chronos 6 years ago.
Breadcrumbs diff based on rev. 11477 from trunk.

Download all attachments as: .zip

Change History (8)

Changed 6 years ago by chronos

The breadcrumbs system.

Changed 6 years ago by chronos

FlatPages patch to support breadcrumbs.

Changed 6 years ago by chronos

Patch to global_settings.py

comment:1 Changed 6 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to 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 Changed 6 years ago by russellm

  • Resolution set to wontfix
  • Status changed from new to 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.

Changed 6 years ago by chronos

Breadcrumbs diff based on rev. 11477 from trunk.

comment:3 Changed 6 years ago by chronos

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.

comment:4 Changed 4 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top