Help me understand a djnago template sintax {% list_column list.columns.username %}

View: New views
2 Messages — Rating Filter:   Alert me  

Help me understand a djnago template sintax {% list_column list.columns.username %}

by NMarcu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello all, please help me understand this django template sintax:

{% list_column list.columns.username %}

I don't know from where is list_column, why is between {% %} and not
between {{ }}. I have a list pass to this tamplate that have colums
and username. The decoratros look like this:

def list(klass, title=None, s_f=None):
    def inner(view):
        def wrapper(request, env={}, *args, **kwargs):
            list = {}
            # template columns
            columns     = {}
            sort_field  = request.GET.get('sort', s_f)
            filters     = []
            for field in klass._meta.fields:
                name                = field.name
                column              = {}
                column['name']      = name
                column['filtered']  = request.GET.get(name, None)
                if column['filtered']:
                    filters.append((name, column['filtered']))
                column['asc_sort']  = sort_field == name
                column['desc_sort'] = sort_field == ('-' + name)
                column['caption']   = field.verbose_name
                columns[name]       = column
            list['columns'] = columns
            items = klass.objects.all()
            pager   = paginator.Paginator(items, 10)
            page_id = int(kwargs['page']) if kwargs.has_key('page')
else 1
            list['page'] = pager.page(page_id)
            list['title'] = title
            u_lg = request.user
            list['user'] = str(u_lg)
            env['list'] = list
           return view(request, env, *args, **kwargs)
        return wrapper
    return inner

This sintax make the head of a table.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers@...
To unsubscribe from this group, send email to django-developers+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Help me understand a djnago template sintax {% list_column list.columns.username %}

by Florian Apolloner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Plz ask usage questions on django-users

Thx.

P.S.: Btw it's "syntax" not "sintax"
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers@...
To unsubscribe from this group, send email to django-developers+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---