Opened 12 years ago

Closed 9 years ago

#19361 closed New feature (fixed)

Link to object in message after creating/updating object in django admin

Reported by: anonymous Owned by: Anton Baklanov
Component: contrib.admin Version: dev
Severity: Normal Keywords: admin, messages, update_object, create_object
Cc: BozeWolf Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When you have a lot of objects listed in the admin, like items in a shop, it is hard to find the object after you created/updated it. Obviously there is an option "Save and continue editing" but in practice it happens that after saving users suddenly realize there are not finished yet.

For example: If i clicked an item in app shop in the middle of the items list, or in search results, I have to find it manually or by using the search-on-page in the browser after saving the object. This problem can easily be solved by adding a link in the message to the object, which appears on top of the page after creating/updating. The title is already in there, so it should not be that hard to resolve the url to the admin page.

Example message: The item "Vintage Star Trek action figure" was changed successfully.
New message: The item "Vintage Star Trek action figure" was changed successfully.

Of course there are some cases, like when the change page ({{ app_label }}_{{ model_name }}_change) is not used or overriden or whatever the coder did to break the url structure and not using the correct names anymore.

Change History (17)

comment:1 by BozeWolf, 12 years ago

Cc: BozeWolf added

I forgot to login when posting this ticket. But i'm the reporter. I added myself to Cc.

Last edited 12 years ago by BozeWolf (previous) (diff)

comment:2 by Anton Baklanov, 12 years ago

Owner: changed from nobody to Anton Baklanov
Status: newassigned
Triage Stage: UnreviewedAccepted

this will be usable

comment:3 by Anton Baklanov, 12 years ago

Version: 1.5-alpha-1master

comment:4 by Anton Baklanov, 12 years ago

some status update:

  • a branch with quick implementation (not finished yet) admin-messages
  • this is kind of depends on #19387. when (if) it will be merged into master we will be able to remove next hunk from diff (i don't like this safe filter there):
    --- a/django/contrib/admin/templates/admin/base.html
    +++ b/django/contrib/admin/templates/admin/base.html
    @@ -53,7 +53,7 @@
         {% block messages %}
             {% if messages %}
             <ul class="messagelist">{% for message in messages %}
    -          <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
    +          <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message|safe }}</li>
             {% endfor %}</ul>
             {% endif %}
         {% endblock messages %}
    

comment:5 by BozeWolf, 12 years ago

Good to see progress. Will test it as soon as it's finished.

comment:7 by Anton Baklanov, 12 years ago

Has patch: set

comment:8 by Anton Baklanov, 11 years ago

Patch needs improvement: set

needs rebase

comment:9 by Anton Baklanov, 10 years ago

Has patch: unset

patch is too old, will try to update it

comment:10 by Anton Baklanov, 9 years ago

Has patch: set
Patch needs improvement: unset

it's been a long time, but here goes rebased pull request https://github.com/django/django/pull/5244

comment:11 by Tim Graham, 9 years ago

Patch needs improvement: set

I left comments for improvement on the pull request.

comment:12 by Anton Baklanov, 9 years ago

Patch needs improvement: unset

comment:13 by Anton Baklanov, 9 years ago

Patch needs improvement: set

comment:14 by Anton Baklanov, 9 years ago

Patch needs improvement: unset

comment:15 by Anton Baklanov, 9 years ago

Patch needs improvement: set

comment:16 by Anton Baklanov, 9 years ago

Patch needs improvement: unset

comment:17 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In 80bcbecd:

Fixed #19361 -- Added link to object's change form in admin's post-save message.

Thanks Roel Kramer for tests.

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