can I have more links in Admin Controller?

22 views
Skip to first unread message

D R Dinesh Kumar

unread,
May 19, 2017, 4:41:07 AM5/19/17
to TurboGears
Hi,

I see that only models can be passed to Admin controller which displays them as links in admin page.
Can also have some custom made links at /admin page?

My code looks like this:


class RootController(BaseController):   
    admin = AdminController([model.User, model.Group, ...], DBSession)

now when I go to /admin it shows my the group item with links to /admin/users and /admin/groups.
Here I would like to add some more items in the same page ex: /admin/task1 and /admin/task2 etc.

How do I achieve this? Using default_index_template is completely loosing the /admin/users and /admin/groups links.
Please help.

With Regards,
Dinesh.

Alessandro Molina

unread,
May 23, 2017, 1:52:30 PM5/23/17
to TurboGears
The admin itself allows only to provide the entities that it should manage, if you want to provide further customisation you can:

1. Provide a `index_payoff ` option to the admin configuration and add there HTML with any additional links
2. Use tgext.pluggable Template Patches to edit the admin template however you need ( https://github.com/TurboGears/tgext.pluggable#patching-templates )
3. Replace the whole default_index_template copying the existing template ( https://raw.githubusercontent.com/TurboGears/tgext.admin/7b0cf2cb2894d44840f3c46fb1dd6e5efccc2736/tgext/admin/templates/bootstrap_index.xhtml ) inside your own project and customising it however you prefer

I usually just go for 3, on long term maintaining patches and configuration options gets far more messy than just providing a custom template.

--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turbogears+unsubscribe@googlegroups.com.
To post to this group, send email to turbo...@googlegroups.com.
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

D R Dinesh Kumar

unread,
May 24, 2017, 7:19:46 PM5/24/17
to TurboGears
Hi Alessandro,

Thank you for the response.

I have used custom_template option to load my own template where it has links to the admin generated pages. 
This way I could manage my custom links and also admin links.

With Regards,
Dinesh.

Raj

unread,
Jul 21, 2017, 12:05:19 PM7/21/17
to TurboGears
Good news
Reply all
Reply to author
Forward
0 new messages