That recursively calls the template again for the next level.
I think the if branch_level ==1 changes to branch_level > 0, then need to add submenu logic to that test case. Somebody clever might be able to merge the whole thing into a single recursive call and merge the two top-level if statements. Right now, it's a bit of a hack.
I'm not sure if this will work unless you update bootstrap to 2.1.
{% load i18n pages_tags %}
{% spaceless %}
{% if page_branch_in_menu %}
{% if branch_level == 0 %}
<ul class="nav nav-collapse pull-left">
{% for page in page_branch %}
{% if page.in_menu %}
{% if page.login_required and
request.user.is_authenticated or not page.login_required %}
<li class="dropdown{% if
page.is_current_or_ascendant %} active{% endif %}"
id="dropdown-menu-{{ page.html_id }}">
<a href="{{ page.get_absolute_url }}">
{{ page.title }}
{% if page.has_children %}<span class="caret"></span>{% endif %}
</a>
{% if page.has_children %}{% page_menu page %}{% endif %}
</li>
<li class="divider-vertical"></li>
{% endif %}
{% endif %}
{% endfor %}
</ul>
{% endif %}
{% if branch_level == 1 %}
<ul class="dropdown-menu">
{% for page in page_branch %}
{% if page.in_menu %}
{% if page.login_required and
request.user.is_authenticated or not page.login_required %}
<li{% if
page.is_current_or_ascendant %} class="active"{% endif %}
id="dropdown-menu-{{ page.html_id }}">
<a href="{{ page.get_absolute_url }}">{{ page.title }}</a>
</li>
{% endif %}
{% endif %}
{% endfor %}
</ul>
{% endif %}
{% endif %}
{% endspaceless %}