python - Django-admin : How to display link to object info page instead of edit form , in records change list? -
I am optimizing Django-admin for an application. So far the customization file is working, added some ideas. But I'm wondering how to change the record_list display to display an information page instead of replacing the links ?!
In this blog post: extending-the-django-admin-interface / Tom said:
"you define a function my_func.allow_tags = true"
adding images or links to the listing view
I could not fully understand!
Ok now I have a profile function, which is required when I click on a member in the record list, I can display it (or another button - by adding profile -), each member How to add links to (edit: redirect me to edit the form for this member).
How can I get it ?!
Regards Hamza
If I think your question is right, You want to add the links to the list view, and you want the link to be the information that you created.
To do this, create a function to return the link HTML in your admin object. Then use that list in your list like this:
Class ModelAdmin (admin.ModelAdmin): DEF view_link (auto, obj): return u "& lt; a href = 'see / % D / '& gt; View & lt; / a & gt; "% Obj.id view_link.short_description =' 'view_link.allow_tags = true list_display = (' id ', view_link)
< / Div>
Comments
Post a Comment