Opened 4 years ago

Closed 10 months 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: master
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 Changed 4 years ago by BozeWolf

Cc: BozeWolf added
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

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

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

comment:2 Changed 4 years ago by Anton Baklanov

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

this will be usable

comment:3 Changed 4 years ago by Anton Baklanov

Version: 1.5-alpha-1master

comment:4 Changed 4 years ago by Anton Baklanov

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 Changed 4 years ago by BozeWolf

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

comment:6 Changed 4 years ago by Anton Baklanov

comment:7 Changed 4 years ago by Anton Baklanov

Has patch: set

comment:8 Changed 3 years ago by Anton Baklanov

Patch needs improvement: set

needs rebase

comment:9 Changed 23 months ago by Anton Baklanov

Has patch: unset

patch is too old, will try to update it

comment:10 Changed 13 months ago by Anton Baklanov

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 Changed 13 months ago by Tim Graham

Patch needs improvement: set

I left comments for improvement on the pull request.

comment:12 Changed 13 months ago by Anton Baklanov

Patch needs improvement: unset

comment:13 Changed 12 months ago by Anton Baklanov

Patch needs improvement: set

comment:14 Changed 12 months ago by Anton Baklanov

Patch needs improvement: unset

comment:15 Changed 12 months ago by Anton Baklanov

Patch needs improvement: set

comment:16 Changed 11 months ago by Anton Baklanov

Patch needs improvement: unset

comment:17 Changed 10 months ago by Tim Graham <timograham@…>

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