Code

Opened 8 years ago

Closed 6 years ago

Last modified 3 years ago

#1390 closed defect (fixed)

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

Reported by: rfroger[at]estrate[dot]nl Owned by: juliae
Component: contrib.admin Version: master
Severity: normal Keywords: nfa-someday
Cc: juliae Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:

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 (4)

app-name-in-admin-breadcrumbs.diff (10.5 KB) - added by ext 7 years ago.
Extended breadcrums in admin (newforms-admin branch)
app-name-in-admin-breadcrumbs2.diff (10.5 KB) - added by eXt 7 years ago.
Updated patch against 6930
updated_app_name_link.diff (10.3 KB) - added by juliae 6 years ago.
updated_app_name_link2.diff (8.7 KB) - added by juliae 6 years ago.

Download all attachments as: .zip

Change History (28)

comment:1 Changed 8 years ago by jacob

  • Reporter changed from rfroger@… to rfroger[at]estrate[dot]nl

comment:2 Changed 7 years ago by Simon G. <dev@…>

  • Triage Stage changed from Unreviewed to Design decision needed

comment:3 Changed 7 years ago 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.

comment:4 Changed 7 years ago by mtredinnick

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

comment:5 Changed 7 years ago by ext

  • Owner changed from nobody to ext

Changed 7 years ago by ext

Extended breadcrums in admin (newforms-admin branch)

comment:6 Changed 7 years ago by ext

  • Has patch set
  • 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.

comment:7 Changed 7 years ago by brosner

  • Keywords nfa-someday added
  • Patch needs improvement set

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.

comment:8 Changed 7 years ago by brosner

Marked #2292 as a duplicate of this.

Changed 7 years ago by eXt

Updated patch against 6930

comment:9 Changed 7 years ago by ext

  • Patch needs improvement unset

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

comment:10 Changed 6 years ago by programmerq

  • milestone set to 1.0

Changed 6 years ago by juliae

comment:11 Changed 6 years ago by juliae

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

comment:12 Changed 6 years ago by mtredinnick

  • Patch needs improvement set
  • Triage 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.

comment:13 Changed 6 years ago 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. :)

comment:14 Changed 6 years ago by mtredinnick

  • Cc juliae added
  • 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.

comment:15 Changed 6 years ago by juliae

  • Owner changed from ext to juliae
  • Status changed from new to assigned

comment:16 Changed 6 years ago 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.

Changed 6 years ago by juliae

comment:17 Changed 6 years ago by juliae

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

comment:18 Changed 6 years ago by clamothe

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

comment:19 Changed 6 years ago by clamothe

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:20 Changed 6 years ago by clamothe

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:21 Changed 6 years ago by brosner

  • Resolution set to fixed
  • Status changed from reopened to closed

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

comment:22 Changed 6 years ago by evenrik

  • Resolution fixed deleted
  • Status changed from closed to reopened

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

comment:23 Changed 6 years ago by Alex

  • Resolution set to fixed
  • Status changed from reopened to closed

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.

comment:24 Changed 3 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.