# {py:mod}`flex_menu.menu`

```{py:module} flex_menu.menu
```

```{autodoc2-docstring} flex_menu.menu
:parser: google_docstrings
:allowtitles:
```

## Module Contents

### Classes

````{list-table}
:class: autosummary longtable
:align: left

* - {py:obj}`_NoParentType <flex_menu.menu._NoParentType>`
  - ```{autodoc2-docstring} flex_menu.menu._NoParentType
    :parser: google_docstrings
    :summary:
    ```
* - {py:obj}`MenuItem <flex_menu.menu.MenuItem>`
  - ```{autodoc2-docstring} flex_menu.menu.MenuItem
    :parser: google_docstrings
    :summary:
    ```
* - {py:obj}`Menu <flex_menu.menu.Menu>`
  - ```{autodoc2-docstring} flex_menu.menu.Menu
    :parser: google_docstrings
    :summary:
    ```
````

### Functions

````{list-table}
:class: autosummary longtable
:align: left

* - {py:obj}`_should_log_url_failures <flex_menu.menu._should_log_url_failures>`
  - ```{autodoc2-docstring} flex_menu.menu._should_log_url_failures
    :parser: google_docstrings
    :summary:
    ```
````

### Data

````{list-table}
:class: autosummary longtable
:align: left

* - {py:obj}`_NO_PARENT <flex_menu.menu._NO_PARENT>`
  - ```{autodoc2-docstring} flex_menu.menu._NO_PARENT
    :parser: google_docstrings
    :summary:
    ```
* - {py:obj}`root <flex_menu.menu.root>`
  - ```{autodoc2-docstring} flex_menu.menu.root
    :parser: google_docstrings
    :summary:
    ```
````

### API

````{py:function} _should_log_url_failures()
:canonical: flex_menu.menu._should_log_url_failures

```{autodoc2-docstring} flex_menu.menu._should_log_url_failures
:parser: google_docstrings
```
````

````{py:class} _NoParentType
:canonical: flex_menu.menu._NoParentType

```{autodoc2-docstring} flex_menu.menu._NoParentType
:parser: google_docstrings
```

````

````{py:data} _NO_PARENT
:canonical: flex_menu.menu._NO_PARENT
:value: >
   '_NoParentType(...)'

```{autodoc2-docstring} flex_menu.menu._NO_PARENT
:parser: google_docstrings
```

````

`````{py:class} MenuItem(name: str, view_name: str = '', url: str | collections.abc.Callable = '', params: dict | None = None, parent: typing.Optional[flex_menu.menu.MenuItem] | flex_menu.menu._NoParentType = None, children: list[flex_menu.menu.MenuItem] | None = None, check: collections.abc.Callable | bool = True, extra_context: dict | None = None, **kwargs)
:canonical: flex_menu.menu.MenuItem

Bases: {py:obj}`anytree.Node`

```{autodoc2-docstring} flex_menu.menu.MenuItem
:parser: google_docstrings
```

```{rubric} Initialization
```

```{autodoc2-docstring} flex_menu.menu.MenuItem.__init__
:parser: google_docstrings
```

````{py:attribute} request
:canonical: flex_menu.menu.MenuItem.request
:type: django.core.handlers.wsgi.WSGIRequest | None
:value: >
   None

```{autodoc2-docstring} flex_menu.menu.MenuItem.request
:parser: google_docstrings
```

````

````{py:attribute} _processed_children
:canonical: flex_menu.menu.MenuItem._processed_children
:type: list[flex_menu.menu.MenuItem]
:value: >
   None

```{autodoc2-docstring} flex_menu.menu.MenuItem._processed_children
:parser: google_docstrings
```

````

````{py:attribute} _original_children
:canonical: flex_menu.menu.MenuItem._original_children
:type: tuple[flex_menu.menu.MenuItem, ...]
:value: >
   None

```{autodoc2-docstring} flex_menu.menu.MenuItem._original_children
:parser: google_docstrings
```

````

````{py:attribute} _cached_url
:canonical: flex_menu.menu.MenuItem._cached_url
:type: str | None
:value: >
   None

```{autodoc2-docstring} flex_menu.menu.MenuItem._cached_url
:parser: google_docstrings
```

````

````{py:method} __str__() -> str
:canonical: flex_menu.menu.MenuItem.__str__

```{autodoc2-docstring} flex_menu.menu.MenuItem.__str__
:parser: google_docstrings
```

````

````{py:method} __getitem__(name: str) -> flex_menu.menu.MenuItem
:canonical: flex_menu.menu.MenuItem.__getitem__

```{autodoc2-docstring} flex_menu.menu.MenuItem.__getitem__
:parser: google_docstrings
```

````

````{py:method} __iter__()
:canonical: flex_menu.menu.MenuItem.__iter__

```{autodoc2-docstring} flex_menu.menu.MenuItem.__iter__
:parser: google_docstrings
```

````

````{py:property} has_url
:canonical: flex_menu.menu.MenuItem.has_url
:type: bool

```{autodoc2-docstring} flex_menu.menu.MenuItem.has_url
:parser: google_docstrings
```

````

````{py:property} has_children
:canonical: flex_menu.menu.MenuItem.has_children
:type: bool

```{autodoc2-docstring} flex_menu.menu.MenuItem.has_children
:parser: google_docstrings
```

````

````{py:property} visible_children
:canonical: flex_menu.menu.MenuItem.visible_children
:type: list[flex_menu.menu.MenuItem]

```{autodoc2-docstring} flex_menu.menu.MenuItem.visible_children
:parser: google_docstrings
```

````

````{py:property} has_visible_children
:canonical: flex_menu.menu.MenuItem.has_visible_children
:type: bool

```{autodoc2-docstring} flex_menu.menu.MenuItem.has_visible_children
:parser: google_docstrings
```

````

````{py:property} is_parent
:canonical: flex_menu.menu.MenuItem.is_parent
:type: bool

```{autodoc2-docstring} flex_menu.menu.MenuItem.is_parent
:parser: google_docstrings
```

````

````{py:property} is_leaf
:canonical: flex_menu.menu.MenuItem.is_leaf
:type: bool

```{autodoc2-docstring} flex_menu.menu.MenuItem.is_leaf
:parser: google_docstrings
```

````

````{py:property} is_clickable
:canonical: flex_menu.menu.MenuItem.is_clickable
:type: bool

```{autodoc2-docstring} flex_menu.menu.MenuItem.is_clickable
:parser: google_docstrings
```

````

````{py:property} depth
:canonical: flex_menu.menu.MenuItem.depth
:type: int

```{autodoc2-docstring} flex_menu.menu.MenuItem.depth
:parser: google_docstrings
```

````

````{py:method} append(child: flex_menu.menu.MenuItem) -> None
:canonical: flex_menu.menu.MenuItem.append

```{autodoc2-docstring} flex_menu.menu.MenuItem.append
:parser: google_docstrings
```

````

````{py:method} extend(children: list[flex_menu.menu.MenuItem]) -> None
:canonical: flex_menu.menu.MenuItem.extend

```{autodoc2-docstring} flex_menu.menu.MenuItem.extend
:parser: google_docstrings
```

````

````{py:method} insert(children: MenuItem | list[MenuItem], position: int) -> None
:canonical: flex_menu.menu.MenuItem.insert

```{autodoc2-docstring} flex_menu.menu.MenuItem.insert
:parser: google_docstrings
```

````

````{py:method} insert_after(child: flex_menu.menu.MenuItem, named: str) -> None
:canonical: flex_menu.menu.MenuItem.insert_after

```{autodoc2-docstring} flex_menu.menu.MenuItem.insert_after
:parser: google_docstrings
```

````

````{py:method} pop(name: str | None = None) -> flex_menu.menu.MenuItem
:canonical: flex_menu.menu.MenuItem.pop

```{autodoc2-docstring} flex_menu.menu.MenuItem.pop
:parser: google_docstrings
```

````

````{py:method} get(name: str, maxlevel: int | None = None) -> typing.Optional[flex_menu.menu.MenuItem]
:canonical: flex_menu.menu.MenuItem.get

```{autodoc2-docstring} flex_menu.menu.MenuItem.get
:parser: google_docstrings
```

````

````{py:method} print_tree() -> str
:canonical: flex_menu.menu.MenuItem.print_tree

```{autodoc2-docstring} flex_menu.menu.MenuItem.print_tree
:parser: google_docstrings
```

````

````{py:method} check(request, **kwargs) -> bool
:canonical: flex_menu.menu.MenuItem.check

```{autodoc2-docstring} flex_menu.menu.MenuItem.check
:parser: google_docstrings
```

````

````{py:method} process(request, **kwargs) -> flex_menu.menu.MenuItem
:canonical: flex_menu.menu.MenuItem.process

```{autodoc2-docstring} flex_menu.menu.MenuItem.process
:parser: google_docstrings
```

````

````{py:method} _create_request_copy() -> flex_menu.menu.MenuItem
:canonical: flex_menu.menu.MenuItem._create_request_copy

```{autodoc2-docstring} flex_menu.menu.MenuItem._create_request_copy
:parser: google_docstrings
```

````

````{py:method} resolve_url(*args, **kwargs) -> str | None
:canonical: flex_menu.menu.MenuItem.resolve_url

```{autodoc2-docstring} flex_menu.menu.MenuItem.resolve_url
:parser: google_docstrings
```

````

````{py:method} _normalized_path(value: str | django.utils.functional.Promise) -> str
:canonical: flex_menu.menu.MenuItem._normalized_path
:staticmethod:

```{autodoc2-docstring} flex_menu.menu.MenuItem._normalized_path
:parser: google_docstrings
```

````

````{py:method} match_url() -> bool
:canonical: flex_menu.menu.MenuItem.match_url

```{autodoc2-docstring} flex_menu.menu.MenuItem.match_url
:parser: google_docstrings
```

````

`````

````{py:data} root
:canonical: flex_menu.menu.root
:value: >
   'MenuItem(...)'

```{autodoc2-docstring} flex_menu.menu.root
:parser: google_docstrings
```

````

`````{py:class} Menu(name: str, children: list[flex_menu.menu.MenuItem] | None = None, check: collections.abc.Callable | bool = True, extra_context: dict | None = None, **kwargs)
:canonical: flex_menu.menu.Menu

Bases: {py:obj}`flex_menu.menu.MenuItem`

```{autodoc2-docstring} flex_menu.menu.Menu
:parser: google_docstrings
```

```{rubric} Initialization
```

```{autodoc2-docstring} flex_menu.menu.Menu.__init__
:parser: google_docstrings
```

````{py:method} _create_request_copy() -> flex_menu.menu.MenuItem
:canonical: flex_menu.menu.Menu._create_request_copy

```{autodoc2-docstring} flex_menu.menu.Menu._create_request_copy
:parser: google_docstrings
```

````

`````
