Skip to content

Instantly share code, notes, and snippets.

@jakab922
Created September 21, 2011 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakab922/1232628 to your computer and use it in GitHub Desktop.
Save jakab922/1232628 to your computer and use it in GitHub Desktop.
# views.py
def landlords(request, lang_code):
template_dict = generate_base_dict(lang_code, '/landlords/')
template_dict['previous_developments'] = [TestimonialDummy('/static/images/prev_dev_thumb1.jpg', 'Cadwell House, London SW13') for i in range(3)]
template_dict['three_element'] = [i for i in range(1,4)]
return render_to_response('pages/landlords.html', template_dict, context_instance = RequestContext(request))
class TestimonialDummy():
def __init__(self, thumbnail, address):
self.thumbnail = thumbnail
self.address = address
def __str__(self):
return str((self.thumbnail, self.address))
# landlords.html template interesting part
{% for previous_development in previous_developments %} <!-- TODO: Table need to be created for this. -->
<li>
<a href="#"><img src="{{ STATIC_URL }}{{ previous_development.thumbnail }}" alt="{% gettext landlords-Previous_development_alt %}"></a>
<strong>{{ previous_development.address }}</strong>
</li>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment