{%- if g.current_user.has_permission(AdminPermission.access) %}

  {%- with
    current_page = current_page|default,
    site = current_page_site|default
  %}
    {%- with party = current_page_party|default %}
    {%- with brand = current_page_brand|default(get_brand_for_party(party) if party else None) %}

        {%- include 'layout/admin/_navigation_global.html' %}

        {%- if site %}
        {%- include 'layout/admin/_navigation_site.html' %}
        {%- endif %}

        {%- if brand %}
        {%- include 'layout/admin/_navigation_brand.html' %}
        {%- endif %}

        {%- if party %}
        {%- include 'layout/admin/_navigation_party.html' %}
        {%- endif %}

      {%- endwith %}
    {%- endwith %}
  {%- endwith %}

{%- endif %}

{%- if g.current_user.has_permission(AdminPermission.access) %}

  {%- with
    current_page = current_page|default,
    site = current_page_site|default,
    brand = current_page_brand|default,
    party = current_page_party|default
  %}
    {%- include 'layout/admin/_navigation_global.html' %}

    {%- if site %}
      {%- include 'layout/admin/_navigation_site.html' %}
    {%- endif %}

    {%- if brand %}
      {%- include 'layout/admin/_navigation_brand.html' %}
    {%- endif %}

    {%- if party %}
      {%- with brand = get_brand_for_party(party) %}
      {%- include 'layout/admin/_navigation_brand.html' %}
      {%- include 'layout/admin/_navigation_party.html' %}
      {%- endwith %}
    {%- endif %}

  {%- endwith %}

{%- endif %}

Rearrange admin navigation template internally
Rearrange admin navigation template internally
