From 80a4a459017940a4bcb93e76400128440f1934a9 Mon Sep 17 00:00:00 2001 From: philipp Date: Wed, 27 Dec 2017 22:31:16 +0000 Subject: [PATCH] gasthaus_list.html now uses jinja2. git-svn-id: http://www.winterrodeln.org/svn/wradmin/trunk@2759 7aebc617-e5e2-0310-91dc-80fb5f6d2477 --- wradmin/controllers/gasthaus.py | 11 +++--- wradmin/templates/gasthaus_list.html | 56 ++++++++++++---------------- 2 files changed, 29 insertions(+), 38 deletions(-) diff --git a/wradmin/controllers/gasthaus.py b/wradmin/controllers/gasthaus.py index b1e9d25..7e25f68 100644 --- a/wradmin/controllers/gasthaus.py +++ b/wradmin/controllers/gasthaus.py @@ -1,5 +1,5 @@ #!/usr/bin/python3.4 -from flask import request, abort, redirect, url_for, flash +from flask import request, abort, redirect, url_for, flash, render_template import paginate import wrpylib.wrmwmarkup @@ -16,11 +16,10 @@ class GasthausController: """Lists all inns""" q = model.meta.Session.query(model.WrInnCache) q = q.order_by(model.WrInnCache.page_title) - c = TemplateContext() - c.paginator = paginate.Page(q.all(), page=int(request.args.get('page', 1)), - url_maker=lambda page: url_for('gasthaus_list', page=page), - items_per_page=25) - return render_genshi_template('gasthaus_list.html', c=c) + paginator = paginate.Page(q.all(), page=int(request.args.get('page', 1)), + url_maker=lambda page: url_for('gasthaus_list', page=page), + items_per_page=25) + return render_template('gasthaus_list.html', paginator=paginator) def view(self, id): """Displays an inn""" diff --git a/wradmin/templates/gasthaus_list.html b/wradmin/templates/gasthaus_list.html index 1fe0517..9448994 100644 --- a/wradmin/templates/gasthaus_list.html +++ b/wradmin/templates/gasthaus_list.html @@ -1,30 +1,21 @@ - - - - +{% extends "master.html" %} +{% block title %}Gasthäuser{% endblock %} - - Gasthäuser - +{% block content %} +

Gasthäuser

- -

Gasthäuser

+

Die folgende Lise wurde automatisiert von den Gasthausboxen gesammelt. Da dies nicht automatisch passiert, kann es sein, dass die Liste "veraltete" Information enthält.

-

Die folgende Lise wurde automatisiert von den Gasthausboxen gesammelt. Da dies nicht automatisch passiert, kann es sein, dass die Liste "veraltete" Information enthält.

+

Gasthausboxen auslesen und DB aktualisieren

-

Gasthausboxen auslesen und DB aktualisieren

- -

${Markup(c.paginator.pager('$link_first $link_previous $first_item bis $last_item von $item_count $link_next $link_last'))}

+

{{paginator.pager('$link_first $link_previous $first_item bis $last_item von $item_count $link_next $link_last') | safe}}

- + @@ -34,22 +25,23 @@ - - - - - - - - - - - - + {% for s in paginator %} + + + + + + + + + + + + + {% endfor %}
ID NameHöheHöhe Telefon E-Mail HomepageLongitude In Arbeit
${s.page_id}${s.page_title}${s.position_elevation}${s.phone_list}${s.email_list}${s.homepage}${h.tristate_tuple(s.nonsmoker_area, s.smoker_area)}${s.image}${s.position_latitude}${s.position_longitude}${h.bool(s.under_construction)}
{{s.page_id}}{{s.page_title}}{{s.position_elevation}}{{s.phone_list}}{{s.email_list}}{{s.homepage}}{{h.tristate_tuple(s.nonsmoker_area, s.smoker_area)}}{{s.image}}{{s.position_latitude}}{{s.position_longitude}}{{h.bool(s.under_construction)}}
-

${Markup(c.paginator.pager('~2~'))}

+

{{paginator.pager('~2~') | safe}}

- - +{% endblock %} -- 2.39.5