conjunto.menu
¶
conjunto.menu.IActionButton
¶
Bases: MenuItemInterfaceMixin
An action button that can be added to an e.g. table row.
| Attributes: |
|
|---|
conjunto.menu.IMenuItem
¶
Bases: MenuItemInterfaceMixin
An extendable and versatile MenuItem Interface
You can use that for creating menu items in a named menu:
class AddUserAction(IMenuItem)
menu = "page_actions"
title = _("Add user")
url = reverse_lazy("user:delete")
icon = "user-delete"
| Attributes: |
|
|---|
selected()
¶
Check current URL against this item.
conjunto.menu.Menu
¶
Represents a named menu during a request.
Usually it is used in Django templates by calling menus.<name>
which then will return all MenuItems with a matching "menu" name
attribute. Therefore, Menu will be instantiated by a context_processor,
so that the menu variable in the template
<ul>
{% for item in menus.user %}
<li><a href="{{item.url}}">{{ item.title }}</a></li>
{% endfor %}
</ul>
__getitem__(item)
¶
Returns filtered out menu items with the given '.menu' name.
conjunto.menu.MenuItemInterfaceMixin
¶
A mixin that provides common functionality for menu items or action buttons etc.
| Attributes: |
|
|---|
__getattr__(item)
¶
For all attrs that are requested in the template and are not defined in the class, don't produce an error, just return an empty string.
children()
¶
Returns an iterable of all children of this menu item.
filter(name)
classmethod
¶
Filter the menu items by the 'menu' key name.
has_children()
¶
Returns True if this menu item has children, False otherwise.
has_parent()
¶
Returns True if this menu item has a parent, False otherwise.