Django

Code

Ticket #1390 (closed: fixed)

Opened 3 years ago

Last modified 3 months ago

Add app name to title and navigation-bar in admin interface

Reported by: rfroger[at]estrate[dot]nl Assigned to: juliae
Milestone: 1.0 Component: django.contrib.admin
Version: SVN Keywords: nfa-someday
Cc: juliae Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 1

Description

I've got a suggestion/feature request which I'll explain by providing an example: An app named 'book' with the models 'books' and 'categories' and an app named 'magazine' with the models 'magazines' and 'categories'. When I use the admin interface and I add or change a category for 'book' then the only way to know you are in the 'book' app is by looking at the URL. The title of the page tells me 'Add category' and the navigation bar tells me 'Home > Categories', which is exactly the same for magazine categories. I think it would be more user friendly if you can see (by just looking at the page) in which app you are. Maybe a title like 'Add category (books)' or 'Add book category' and the navigation bar with 'Home > Categories (book)' or 'Home > Book categories'.

The navigation bar could even show 'Home > Book > Categories', that introduces a new admin view which shows all models for one app.

By the way I'm using the trunk version. I'm new to Django so I can't provide you with a patch to add my suggestion (yet!).

Attachments

app-name-in-admin-breadcrumbs.diff (10.5 kB) - added by ext on 09/14/07 07:21:16.
Extended breadcrums in admin (newforms-admin branch)
app-name-in-admin-breadcrumbs2.diff (10.5 kB) - added by eXt on 12/10/07 13:43:39.
Updated patch against 6930
updated_app_name_link.diff (10.3 kB) - added by juliae on 08/09/08 21:10:10.
updated_app_name_link2.diff (8.7 kB) - added by juliae on 08/21/08 10:41:40.

Change History

03/08/06 20:57:43 changed by jacob

  • reporter changed from rfroger@estrate.nl to rfroger[at]estrate[dot]nl.

02/22/07 01:07:26 changed by Simon G. <dev@simon.net.nz>

  • stage changed from Unreviewed to Design decision needed.

03/10/07 04:42:30 changed by mtredinnick

This isn't a bad suggestion. Not worth worrying about in existing admin, but should be looked at for newforms-admin, once that's completed. Still needs design work to decide how to display the titles, since there are a few variations, but the concept seems sound.

Note that anybody thinking about this should focus on how the title as a whole looks, not how it looks in tabs, since difference browsers abbreviate tab titles in different ways (chopping at either the front or the back). So now arguments along the lines of "it should be this way because my browser's tabs show the first few characters", please.

04/25/07 06:01:58 changed by mtredinnick

  • stage changed from Design decision needed to Accepted.

Let's call this "accepted" so that somebody might be interested in writing a patch. It'll be easier to debate the final look with a patch to work against.

09/14/07 02:26:24 changed by ext

  • owner changed from nobody to ext.

09/14/07 07:21:16 changed by ext

  • attachment app-name-in-admin-breadcrumbs.diff added.

Extended breadcrums in admin (newforms-admin branch)

09/14/07 07:43:42 changed by ext

  • has_patch set to 1.
  • version changed from SVN to newforms-admin.

The patch I attached extends admin's (newforms-admin) breadcrumbs placing app_label between Home and model name. It now looks as suggested by reporter:

'Home > Book > Categories'

I also introduced a new admin view which shows all models for one app so the app_label (Book in above example) is clickable.

The solution makes it easy to get to know what application a specific model belongs to, but I think that there are some design decisions needed to choose whether: 1. Should app_label be clickable? Is it really useful to have a view on application specific models only? 2. Should app_label visibility be configurable? Are there any situations when one doesn't want to see an application name? Maybe app_label should have also something like model's verbose_name? 3. Does it still makes sense to add an application name to title? I think no, so I discontinued my work on it.

12/07/07 17:31:20 changed by brosner

  • keywords set to nfa-someday.
  • needs_better_patch set to 1.

Assuming this patch still applies cleanly I think it should go in. Marking patch needs improvement so that it can be unchecked once verified or has been updated.

12/07/07 17:38:11 changed by brosner

Marked #2292 as a duplicate of this.

12/10/07 13:43:39 changed by eXt

  • attachment app-name-in-admin-breadcrumbs2.diff added.

Updated patch against 6930

12/10/07 13:50:26 changed by ext

  • needs_better_patch deleted.

I've updated the patch so it applies cleanly to rev. 6930 (latest one at the moment). I've unchecked path-needs-improvement tick.

06/17/08 11:50:13 changed by programmerq

  • milestone set to 1.0.

08/09/08 21:10:10 changed by juliae

  • attachment updated_app_name_link.diff added.

08/09/08 21:11:10 changed by juliae

  • stage changed from Accepted to Ready for checkin.

Added updated patch to reflect rev. 8252, post 1.0 alpha 2. Just a slight difference to reflect updates and changes to site.py in django/contrib/admin. I have tested locally and it works for me. Might want to think about expanding the navigation.

08/09/08 21:33:31 changed by mtredinnick

  • needs_better_patch set to 1.
  • stage changed from Ready for checkin to Accepted.

A few quick comments from reading through this:

  1. Make sure you start from a clean tree with no other changes. The change in django/contrib/auth/models.py is unrelated to this (it was another patch you were creating yesterday).
  2. Be careful not to change more than you need to. All the changes from double-quotes to single-quotes aren't changing any functionality, so they aren't necessary. Also, the change in django/contrib/admin/options.py on line 689 (line 692 in the new version) actually introduces a bug (for python 2.3). So be careful about not making unnecessary changes like that.

The rest of it -- the core functional changes -- look fine, although I haven't reviewed the additions in django/contrib/admin/sites.py beyond an initial read through yet.

08/10/08 00:15:03 changed by brosner

This looks good to me. In addition to what Malcolm said the latest patch also is missing the app_index.html template. You likely need to do the svn add on the file before svn diff. :)

08/16/08 17:59:16 changed by mtredinnick

  • cc set to juliae.
  • version changed from newforms-admin to SVN.

@brosner: I spoke to Julia in real life about this and she mentioned she's got the missing files on her laptop and will update the patch.

08/18/08 01:54:20 changed by juliae

  • owner changed from ext to juliae.
  • status changed from new to assigned.

08/18/08 11:12:45 changed by juliae

Updated patch to fix issues listed above - thanks guys! Also, idea to add a "Recent Actions" panel to this part of the admin interface (thanks to Nathan Borror). Working on this today and will keep you posted on my progress.

08/21/08 10:41:40 changed by juliae

  • attachment updated_app_name_link2.diff added.

08/21/08 10:57:48 changed by juliae

  • stage changed from Accepted to Ready for checkin.

Spoke with Malcolm this morning and decided that the addition of "Recent Actions" to app_index.html template should be added post 1.0.

08/22/08 13:06:51 changed by clamothe

The updated_app_name_link2.diff patch passes all tests against r8466, and the admin changes work properly.

08/22/08 18:50:34 changed by clamothe

  • status changed from assigned to closed.
  • resolution set to fixed.

08/22/08 18:51:18 changed by clamothe

  • status changed from closed to reopened.
  • resolution deleted.

08/22/08 23:00:15 changed by brosner

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [8474]) Fixed #1390 -- Added an app index in the admin interface. Thanks juliae and ext for their work on patches.

08/26/08 17:23:07 changed by evenrik

  • status changed from closed to reopened.
  • resolution deleted.

The change made to django/contrib/admin/sites.py generated:

Traceback (most recent call last):

  File "/usr/lib/python2.3/site-packages/django/core/handlers/base.py", line 86, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/usr/lib/python2.3/site-packages/django/contrib/admin/sites.py", line 175, in root
    return self.app_index(request, url)

  File "/usr/lib/python2.3/site-packages/django/contrib/admin/sites.py", line 392, in app_index
    app_dict = {

UnboundLocalError: local variable 'model_dict' referenced before assignment

08/26/08 17:29:50 changed by Alex

  • status changed from reopened to closed.
  • resolution set to fixed.

Please do not reopen this ticket, the original issue has been solved, if you find that there is a new issue, please open a new ticket.


Add/Change #1390 (Add app name to title and navigation-bar in admin interface)




Change Properties
Action