Hi together,
till now we worked with PHP. For a new database I desided to try
python and django.
I´m trying to find the right way and now I have a problem, that I can
´t get data within a template.
My view:
from Django_Demo.news.models import D300, D200, D840
from django.http import HttpResponse
from django.template import Context, loader
def d300_anz(request):
template = loader.get_template("news/d300.html")
context = Context({"anzeige" : D300.objects.all()})
return HttpResponse(template.render(context))
My template:
{% extends "news/basis.html" %}
{% block titel %}D300-Übersicht{% endblock %}
{% block inhalt %}
hier 1<br/>
<!--{% for n in object_list %} -->
{% for n in D300.objects.all %}
hier 2<br/>
<div class="kontainer">
<div class="titelzeile">
<div class="titel">{{ n.titel|escape }}</div>
<div class="zeitstempel">{{ n.zeitstempel }}</div>
<div style="clear: both"></div>
</div>
<div class="text">
{{ n.text|escape|linebreaksbr }}
<div class="link_unten">
<a href="{{ n.id }}/">Details</a>
</div>
</div>
</div>
{% endfor %}
hier 3<br/>
{% endblock %}
Wether witch of the for-loops I try, in browser, I only can see
D300-Übersicht
hier 1
hier 2
Wether in object_list nor in model D300.objects are data found.
If I make an output of D300 database in view without templates the
data are shown.
What is wrong with the template?
thanks for any help
Uli
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---