newbie question about breadcrumbs

76 views
Skip to first unread message

Mirto Silvio Busico

unread,
Oct 9, 2008, 9:04:38 AM10/9/08
to django...@googlegroups.com
Hi all,
I'm lost in understanding how to use/reuse or create breadcrumbs.

Where can I find documentation /examples of setting up breadcrumbs?

This is my use case:
I have a site with the admin app. So I have:

mysyte
(admin)
myapp1
myapp2

The mysite site is hosted behind apache (e.g. http://localhost/mysite/ )

I have and index page in:
http://localhost/mysite/ (no breadcrumbs)
http://localhost/mysite/ (breadcrumbs should be: Home
[pointing to / which is intepreted as http://localhost/mysite/ ])
http://localhost/mysite/admin (breadcrumbs
should be: Home [pointing to / ] -> Mysite [pointing to /mysite ] ->
Admin [pointing to /mysite/admin and this is the Home of admin]
http://localhost/mysite/myapp1 (breadcrumbs
should be: Home [pointing to / ] -> Mysite [pointing to /mysite ] ->
myapp1 [pointing to /mysite/myapp1 ]
http://localhost/mysite/myapp2 (breadcrumbs
should be: Home [pointing to / ] -> Mysite [pointing to /mysite ] ->
myapp2 [pointing to /mysite/myapp2 ]

I'm confused because the admin app seems unaware of living inside a
project that is inside an apache site: the home link always point to the
first admin app page
In the myappX pages (tacking the breadcrumbs block from the base.html of
the admin app) the construted breadcrumbs contain always 2 entries: an
Home (pointing to / - so the apache site) an a not acrive entry with the
page name.

So I'm convinced that I have misunderstood all the breadcrumbs matter.

Please, someone can give me hits and/or documentation links?

Thanks
Mirto

--

_________________________________________________________________________
Busico Mirto Silvio
Consulente ICT
cell. 333 4562651
email m.bu...@ieee.org

Malcolm Tredinnick

unread,
Oct 9, 2008, 9:30:29 AM10/9/08
to django...@googlegroups.com

On Thu, 2008-10-09 at 15:04 +0200, Mirto Silvio Busico wrote:
[...]

> So I'm convinced that I have misunderstood all the breadcrumbs matter.

I think you're just expecting something to happen that isn't true. The
breadcrumbs in the admin are always going to be

(1) Home -- pointing to the root admin page
(2) App name -- pointing to a page containing all the models in that
particular app
(3) Model name

Where the last two might not be shown if they aren't relevant (for
example, no model name is shown if you're on the app name page and no
app name or models if you're on the home page).

Django has no concept of the Apache root ("/"). The "home" link is the
admin site.

Regards,
Malcolm


Carl Meyer

unread,
Oct 9, 2008, 9:32:57 AM10/9/08
to Django users
Hi Mirto,

On Oct 9, 9:04 am, Mirto Silvio Busico <m.bus...@ieee.org> wrote:
> I'm confused because the admin app seems unaware of living inside a
> project that is inside an apache site: the home link always point to the
> first admin app page

The admin breadcrumbs are never aware of anything outside the admin,
and that is by design. In order to change that you'll need to do
quite a bit of poking around in the admin templates, override the
proper block(s) and do your own breadcrumb logic.

> In the myappX pages (tacking the breadcrumbs block from the base.html of
> the admin app) the construted breadcrumbs contain always 2 entries: an
> Home (pointing to / - so the apache site) an a not acrive entry with the
> page name.

The breadcrumbs for your own apps should not involve pulling anything
from the admin. Just put the top two breadcrumbs (/ and /mysite) in
your site-wide base.html, then pull that into your app templates using
{{ block.super }} and append the app-specific breadcrumbs.

Carl

Mirto Silvio Busico

unread,
Oct 9, 2008, 10:39:35 AM10/9/08
to django...@googlegroups.com
Thanks to all who have replied.
I'll try our suggestions

Mirto

Carl Meyer ha scritto:

Thomas Guettler

unread,
Oct 10, 2008, 9:53:57 AM10/10/08
to django...@googlegroups.com
Mirto Silvio Busico schrieb:

> Hi all,
> I'm lost in understanding how to use/reuse or create breadcrumbs.
>
> Where can I find documentation /examples of setting up breadcrumbs?
>
>
Hi,

I wrote a small snippet that we use in our projects:

http://www.djangosnippets.org/snippets/1026/

Of course it only works for views that you created. It does not change
the breadcrumbs of the admin page.

Thomas

--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

Reply all
Reply to author
Forward
0 new messages