<commit_before>import re
from django import template
from django.template import Library, Node, TemplateSyntaxError
from django.core.urlresolvers import reverse, get_resolver
from core.models import NavigationNode

register = template.Library()

@register.tag(name="get_top_navigation")
def get_top_navigation(parser, token):
    try:
        bits = token.split_contents()
    except ValueError:
        raise TemplateSyntaxError(_('tag requires exactly two arguments'))
    if bits[1] != 'as':
        raise TemplateSyntaxError(_("first argument to tag must be 'as'"))
    return TopNavigationNode(bits[2])
        
class TopNavigationNode(Node):
    """
    Get the top navigation and add to the context
    """
    def __init__(self, context_var):
        self.context_var = context_var
 
    def render(self, context):
        context[self.context_var] = NavigationNode.objects.filter(parentNode=None)
        return ''<commit_msg>Fixed order of navigation<commit_after>import re
from django import template
from django.template import Library, Node, TemplateSyntaxError
from django.core.urlresolvers import reverse, get_resolver
from core.models import NavigationNode

register = template.Library()

@register.tag(name="get_top_navigation")
def get_top_navigation(parser, token):
    try:
        bits = token.split_contents()
    except ValueError:
        raise TemplateSyntaxError(_('tag requires exactly two arguments'))
    if bits[1] != 'as':
        raise TemplateSyntaxError(_("first argument to tag must be 'as'"))
    return TopNavigationNode(bits[2])
        
class TopNavigationNode(Node):
    """
    Get the top navigation and add to the context
    """
    def __init__(self, context_var):
        self.context_var = context_var
 
    def render(self, context):
        context[self.context_var] = NavigationNode.objects.filter(parentNode=None).order_by('-id')
        return ''
{'fraction_non_alphanumeric': 0.09378292939936776, 'fraction_numerical': 0.002107481559536354, 'mean_word_length': 3.9712041884816753, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6628928', 'n_tokens_mistral': 511, 'n_tokens_neox': 506, 'n_words': 149}