Code

Opened 17 months ago

Last modified 2 months ago

#19361 assigned New feature

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

Reported by: anonymous Owned by: bak1an
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: yes
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.

Attachments (0)

Change History (8)

comment:1 Changed 17 months 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 owner. I added myself to Cc.

Version 0, edited 17 months ago by BozeWolf (next)

comment:2 Changed 17 months ago by bak1an

  • Owner changed from nobody to bak1an
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

this will be usable

comment:3 Changed 17 months ago by bak1an

  • Version changed from 1.5-alpha-1 to master

comment:4 Changed 17 months ago by bak1an

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 16 months ago by BozeWolf

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

comment:7 Changed 14 months ago by bak1an

  • Has patch set

comment:8 Changed 2 months ago by bak1an

  • Patch needs improvement set

needs rebase

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as assigned
The owner will be changed from bak1an to anonymous. Next status will be 'assigned'
The ticket will be disowned. Next status will be 'new'
as The resolution will be set. Next status will be 'closed'
Author


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

 
Note: See TracTickets for help on using tickets.