I have a model called Advertisement. This model has text field, title field, and file field.
I am successfully saving all 3 of these fields into the model.
Now I need to show them in template. My vision is:
ads = Advertisement.objects.all()
return render_to_response('page.html', {'ads':ads},context_instance=RequestContext(request))
and in my page.html:
{% for each_ad in ads %}
<p>{{each_ad.title}}</p>
<p>{{each_ad.text}}</p>
<p><a href="/ads/{{each_ad.file_pdf}}>{{each_ad.file_pdf.name}}</a></p>
{% endfor %}
Does this seem right? If not, please show me the way so I can learn. Thanks!