Add a simple admin menu item for django-admin url.

826 views
Skip to first unread message

YusufSalahAdDin

unread,
Feb 18, 2016, 2:45:58 PM2/18/16
to Wagtail support
Hi guys,

I want ad an item with django-admin url in admin menú, but with register-admin-menu i can't do it.

What can i do?

Matthew Westcott

unread,
Feb 19, 2016, 5:32:58 AM2/19/16
to wag...@googlegroups.com
What have you tried so far? Does the example code snippet on http://docs.wagtail.io/en/v1.3.1/reference/hooks.html work for you?

Cheers,
- Matt

YusufSalahAdDin .

unread,
Feb 20, 2016, 10:56:44 PM2/20/16
to wag...@googlegroups.com
I use the registe_sub_menu_item and register_admin_menu_item, but how my item haven't other urls, show me one error about two missing args.



My code is this:
@hooks.register('register_settings_menu_item')
def register_django_admin_menu_item(request, items):
return MenuItem(_('Site Admin'), reverse('django-admin'), classnames='icon icon-folder-inverse', order=10000)
Thanks.


--
You received this message because you are subscribed to a topic in the Google Groups "Wagtail support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wagtail/49RKCkEkTO4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wagtail+u...@googlegroups.com.
To post to this group, send an email to wag...@googlegroups.com.
Visit this group at https://groups.google.com/group/wagtail.
To view this discussion on the web, visit https://groups.google.com/d/msgid/wagtail/24D26C65-75AE-460F-BA71-FA059F2ADB04%40torchbox.com.
For more options, visit https://groups.google.com/d/optout.

Matthew Westcott

unread,
Feb 21, 2016, 7:29:21 AM2/21/16
to wag...@googlegroups.com
The register_settings_menu_item hook doesn't take 'request' / 'items' parameters - you should remove those. (Also, I don't think reverse('django-admin') will work, because reverse(...) expects a named URL pattern, and I don't think django-admin uses those - I'd suggest just using the '/django-admin' URL directly.)

@hooks.register('register_settings_menu_item')
def register_django_admin_menu_item():
return MenuItem(_('Site Admin'), '/django-admin', classnames='icon icon-folder-inverse', order=10000)


Cheers,
- Matt

On 21 Feb 2016, at 03:56, YusufSalahAdDin . <alag...@gmail.com> wrote:

> I use the registe_sub_menu_item and register_admin_menu_item, but how my item haven't other urls, show me one error about two missing args.
>
> <TypeError at -admin- - Chromium_013.png>

YusufSalahAdDin .

unread,
Feb 22, 2016, 8:48:14 PM2/22/16
to wag...@googlegroups.com
It works! Thank you very much!

--
You received this message because you are subscribed to a topic in the Google Groups "Wagtail support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wagtail/49RKCkEkTO4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wagtail+u...@googlegroups.com.
To post to this group, send an email to wag...@googlegroups.com.
Visit this group at https://groups.google.com/group/wagtail.
Reply all
Reply to author
Forward
0 new messages