Hey Guys,
my problem is, as shown in the subject, that the template-engine puts in the 
name of the templatevariable instead of the value:

my view:

def YearlyView(request, calid, year):
    lst = []
    k = get_object_or_404(Kalender, pk=calid)
    now_year, now_month = datetime.date.today().year, 
datetime.date.today().month 
    mlst = []
    for n, month in enumerate(mnames):
        entry = current = False
        entries = k.termin_set.filter(date__year=year, date__month=n+1)
    
        if entries:
            entry = True
        if year == now_year and n+1 == now_month:
            current = True
        mlst.append({'n':n+1, 'month':month, 'entry':entry, 
'current':current})
    
    return render_to_response("kalender/year.html", {'months':mlst, 
'user':request.user, 'yearh':year,'calid':calid})

Now i want to iterate through mlst alias 'months' in the template:

{% for current, entry, month, n in months %}
    <span class=
    {% if current %}"current"{% else %}
    "month{% endif %} >
    {% if entry %}<b>{% endif %}
    <a href="http://foo.bar/";>{{ month }}</a>
    {% if entry %}</b>{% endif %}
</div> {% if n == 6 %} </br> {% endif %}

{# show content of the variables for debugging #}cur: {{ current }} entr: {{ 
entry }} mon: {{ month }} n: {{ n }} </br>

{% endfor %}

So there should be links with the name of the month, but instead there is:

* month <http://foo.bar/> * cur: current entr: entry mon: month n: n 
 * month <http://foo.bar/> * cur: current entr: entry mon: month n: n 
 * month <http://foo.bar/> * cur: current entr: entry mon: month n: n 
 * month <http://foo.bar/> * cur: current entr: entry mon: month n: n 
 * month <http://foo.bar/> * cur: current entr: entry mon: month n: n 
 * month <http://foo.bar/> * cur: current entr: entry mon: month n: n 
 * month <http://foo.bar/> * cur: current entr: entry mon: month n: n 
 * month <http://foo.bar/> * cur: current entr: entry mon: month n: n 
 * month <http://foo.bar/> * cur: current entr: entry mon: month n: n 
 * month <http://foo.bar/> * cur: current entr: entry mon: month n: n 
 * month <http://foo.bar/> * cur: current entr: entry mon: month n: n 
 * month <http://foo.bar/> * cur: current entr: entry mon: month n: n 

So instead of "mon: Januar n: 1" etc. the names of the variables are 
displayed.

Why does it behave so and how to solve the problem?



And another question: In the view the order of the key-value-pairs in the 
dict mlst is set as 'n, month, entry, current' but in the template it is 
reversed...
Why?

Thanks for help...
And if I wrote too confusing, feel free to ask! ;-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/tGa_yx2tVEsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to