Change.html temolate example
Closed this issue · 1 comments
sunjoomoon commented
Very interesting trial in the world of Django. Anybody has change.html template code example?
frol commented
Here is an extract from our project:
change.html:
{% extends "auth/profile_base_edit.html" %}
{% load i18n %}
{% load pagination_tags %}
{% load misc_tags %}
{% block external_css %}
{{ super() }}
<link href="{{ THEME_STATIC_URL }}css/themes.css" rel="stylesheet" type="text/css">
{% endblock %}
{% block themes_tab_class %} ui-tabs-selected ui-state-active{% endblock %}
{% block body_content %}
<h2>{% trans %}Change theme{% endtrans %}</h2>
<div id="themes_list">
{% if themes %}
{% for theme in themes %}
{% set curr_id = loop.index0 %}
{% include "themes/theme_item.html" %}
{% endfor %}
{% endif %}
</div>
{% endblock %}
theme_item.html:
{% load i18n %}
<div class="theme_item_{{ loop.cycle("odd", "even") }}">
<div class="theme_screenshot"><img src="{{ theme.screenshot }}"/></div>
<div class="theme_info">
<p><b>{% trans %}Name{% endtrans %}: </b>{{ theme.name }}</p>
<p><b>{% trans %}Description{% endtrans %}: </b>{{ theme.description }}</p>
{% if curr_id != current_theme_id %}
<a href="{% url "themes_change_id" curr_id %}">{% trans %}Set theme{% endtrans %}</a>
{% else %}
{% trans %}Current theme{% endtrans %}
{% endif %}
</div>
<div class="clearfix"></div>
</div>