Now i understand and this way it makes sense.
Thank you very much
Uli

On 5 Aug., 15:54, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Aug 5, 1:44 pm, Frulli58 <ulrich.frie...@kapp-coburg.de> wrote:
>
>
>
> > 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-&Uuml;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
>
> The template can only use the variables you actually pass into the
> view via the context. In the context, you've called the object list
> 'anzeige'. So that's the name you have to use in the template loop:
> {% for n in anzeige %}
> --
> DR.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
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