Yes. It's can be done on template layer.
Just create custom index admin template. See example in django source.
You need to create you own module table with appropriate model rows.
For example:
{% for app in app_list %}
{% if app.app_label == 'insert_after_app_label %}
<div class="app-custom module">
<table>
<caption>
<a href="javascript:void(0);" title="No list presentation in this entry">My custom entry</a>
</caption>
{% for model in app.models %}
<tr class="model-custom-entry">
<th scope="row"><a href="/my_view_url/">My view title</a></th>
<th scope="row">My view title</th>
<td><a href="/my_view_add_link/" class="addlink">{% trans 'Add' %}</a></td>
<td><a href="/my_view_change_link/" class="changelink">{% trans 'Change' %}</a></td>
</tr>
</table>
</div>
{% endif %}
...
{% endfor %}
On Friday, October 11, 2013 3:57:49 PM UTC+6, Juan Antonio García Cano wrote:
-- Just create custom index admin template. See example in django source.
You need to create you own module table with appropriate model rows.
For example:
{% for app in app_list %}
{% if app.app_label == 'insert_after_app_label %}
<div class="app-custom module">
<table>
<caption>
<a href="javascript:void(0);" title="No list presentation in this entry">My custom entry</a>
</caption>
{% for model in app.models %}
<tr class="model-custom-entry">
<th scope="row"><a href="/my_view_url/">My view title</a></th>
<th scope="row">My view title</th>
<td><a href="/my_view_add_link/" class="addlink">{% trans 'Add' %}</a></td>
<td><a href="/my_view_change_link/" class="changelink">{% trans 'Change' %}</a></td>
</tr>
</table>
</div>
{% endif %}
...
{% endfor %}
On Friday, October 11, 2013 3:57:49 PM UTC+6, Juan Antonio García Cano wrote:
In my django admin site, i have the menu with the name of my app and in this section all the models that i have registered in admin.pyI want to know if it is posible to put in the main menu and submenu a custom entry, with custom templates. (These pages will be only for work and show data, there will be not "admin.site.register(...)")It is posible to do this?
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ad09b542-21ec-4a4e-b5a4-7b62c05dc7dd%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment