summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorsubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-05-13 05:52:15 +0100
committersubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-05-13 05:52:15 +0100
commitd25fd97864611c3be326412ae4aa84e8ad01cd66 (patch)
tree0062d37e453ad21f98411f9a208e3c6b344412c7 /templates
parent3b35b6bb76f41f9c086e43d31f45aee25403a507 (diff)
downloadtroggle-d25fd97864611c3be326412ae4aa84e8ad01cd66.tar.gz
troggle-d25fd97864611c3be326412ae4aa84e8ad01cd66.tar.bz2
troggle-d25fd97864611c3be326412ae4aa84e8ad01cd66.zip
[svn] My crusade to make our project more Djangoic.
Got rid of the url tags in template, replaced them with get_absolute_url method calls where possible. Adding get_absolute_url in models enables direct link to the public model views in admin. The use of get_absolute_url, which is the correct Django way of doing things, eliminates any need for the redundant "href" fields we were using. Those fields now need to be deleted from the models and from the parsers. Made the context processor to pass settings to all templates actually work, although this was a little uglier than expected. I had to put in a new render_response to replace render_to_response. This is because Django uses Context, not RequestContext by default. I wish they would change this, it's annoying. Anyway, I deleted all the manual settings passing in the views. I also eliminated a couple of unnecessary methods and stuff like that. Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8244 by aaron @ 2/16/2009 8:31 AM
Diffstat (limited to 'templates')
-rw-r--r--templates/calendar.html15
-rw-r--r--templates/cave.html2
-rw-r--r--templates/caveindex.html4
-rw-r--r--templates/expedition.html104
-rw-r--r--templates/logbookentry.html15
-rw-r--r--templates/person.html2
-rw-r--r--templates/personexpedition.html10
-rw-r--r--templates/personindex.html12
-rw-r--r--templates/survey.html14
9 files changed, 97 insertions, 81 deletions
diff --git a/templates/calendar.html b/templates/calendar.html
index b4ad49d..5ff2778 100644
--- a/templates/calendar.html
+++ b/templates/calendar.html
@@ -21,6 +21,18 @@
{% endblock %}
+{% block contentheader %}
+ <h2>Expedition members present calendar for {{ expedition.year }}</h2>
+ <table style="margin:0 auto">
+ <tr>
+ <td class='yes' width="10"></td><td>Expedition member present in Austria</td>
+ </tr>
+ <tr>
+ <td class='no' width="10"></td><td>Expedition member absent in Austria</td>
+ </tr></table>
+ <br />
+{% endblock%}
+
{% block content %}
{% if expedition %}
<table>
@@ -47,7 +59,8 @@
{% for personexpedition in expedition.personexpedition_set.all %}
<tr>
<td class="name">
- {{ personexpedition.person }}
+ <a href="">{{ personexpedition.person }}</a>
+
</td>
{% if personexpedition.ListDaysTF %}
{% for dateTF in personexpedition.ListDaysTF %}
diff --git a/templates/cave.html b/templates/cave.html
index 495e2f7..c97b9cd 100644
--- a/templates/cave.html
+++ b/templates/cave.html
@@ -10,7 +10,7 @@
{% if logbookentry.title %}
<tr>
<td>{{logbookentry.date}}</td>
- <td><a href="{% url logbookentry logbookentry.href %}">{{logbookentry.title|safe}}</a></td>
+ <td><a href="{{ logbookentry.get_absolute_url }}">{{logbookentry.title|safe}}</a></td>
</tr>
{% endif %}
{% endfor %}
diff --git a/templates/caveindex.html b/templates/caveindex.html
index b38e69f..d9e4748 100644
--- a/templates/caveindex.html
+++ b/templates/caveindex.html
@@ -8,14 +8,14 @@
<h3>Notable caves</h3>
<ul>
{% for cave in notablecaves %}
- <li> <a href="{% url cave cave.href %}">{{cave.official_name|wiki_to_html_short}} ({{cave.href}})</a> </li>
+ <li> <a href="{{ cave.get_absolute_url }}">{{cave.official_name|wiki_to_html_short}} ({{cave.href}})</a> </li>
{% endfor %}
</ul>
<h3>All caves</h3>
<ul>
{% for cave in caves %}
- <li> <a href="{% url cave cave.href %}">{{cave.official_name|wiki_to_html_short}} ({{cave.href}})</a> </li>
+ <li> <a href="{{ cave.get_absolute_url }}">{{cave.official_name|wiki_to_html_short}} ({{cave.href}})</a> </li>
{% endfor %}
</ul>
diff --git a/templates/expedition.html b/templates/expedition.html
index e4f12f0..b6be4ac 100644
--- a/templates/expedition.html
+++ b/templates/expedition.html
@@ -1,52 +1,52 @@
-{% extends "base.html" %}
-{% load wiki_markup %}
-
-{% block title %}Expedition {{expedition.name}}{% endblock %}
-
-{% block content %}
-<h2>{{expedition.name}}: {{expedition.date_from}} - {{expedition.date_to}}</h2>
-
-<div id="col2">
-<table class="prevnextexpeditions">
-<tr>
- <td>{% if expedition_prev %}&lt; &lt; <a href="{% url expedition expedition_prev.year %}">{{expedition_prev.year}}</a>{% endif %}</td>
- <td>{% if expedition_next %}&gt; &gt; <a href="{% url expedition expedition_next.year %}">{{expedition_next.year}}</a>{% endif %}</td>
-</tr>
-</ul>
-
-<table class="expeditionpersonlist">
-<tr><th>Caver</th><th>From</th><th>To</th></tr>
-{% for personexpedition in expedition.personexpedition_set.all %}
- <tr>
- <td><a href="{% url personexpedition personexpedition.person.href personexpedition.expedition.year %}">{{personexpedition.person}}</a></td>
- <td>{{personexpedition.date_from}}</td>
- <td>{{personexpedition.date_to}}</td>
- </tr>
-{% endfor %}
-</table>
-</div>
-
-<div id="col1">
-<h3>Logbook entries</h3>
-<form action="" method="GET"><input type="submit" name="reload" value="Reload"></form>
-<p>debug message: {{message}}</p>
-
-<table class="expeditionlogbooks">
-<tr><th>Date</th><th>Title</th><th>Author</th><th>Place</th></tr>
-{% for logbookentry in logbookentries %}
- <tr>
- <td>{{logbookentry.date}}</td>
- <td><a href="{% url logbookentry logbookentry.href %}">{{logbookentry.title|safe}}</td>
- <td><a href="{% url personexpedition logbookentry.author.person.href logbookentry.author.expedition.year %}">{{logbookentry.author.name}}</a></td>
-
- {% if logbookentry.cave %}
- <td><a href="{% url cave logbookentry.cave.href %}">{{logbookentry.place}}</a></td>
- {% else %}
- <td>{{logbookentry.place}}</td>
- {% endif %}
- </tr>
-{% endfor %}
-</table>
-</div>
-
-{% endblock %}
+{% extends "base.html" %}
+{% load wiki_markup %}
+
+{% block title %}Expedition {{expedition.name}}{% endblock %}
+
+{% block content %}
+<h2>{{expedition.name}}: {{expedition.date_from}} - {{expedition.date_to}}</h2>
+
+<div id="col2">
+<table class="prevnextexpeditions">
+<tr>
+ <td>{% if expedition_prev %}&lt; &lt; <a href="{{ expedition_prev.get_absolute_url }}">{{expedition_prev.year}}</a>{% endif %}</td>
+ <td>{% if expedition_next %}&gt; &gt; <a href="{{ expedition_next.get_absolute_url }}">{{expedition_next.year}}</a>{% endif %}</td>
+</tr>
+</ul>
+
+<table class="expeditionpersonlist">
+<tr><th>Caver</th><th>From</th><th>To</th></tr>
+{% for personexpedition in expedition.personexpedition_set.all %}
+ <tr>
+ <td><a href="{{ personexpedition.get_absolute_url }}">{{personexpedition.person}}</a></td>
+ <td>{{personexpedition.date_from}}</td>
+ <td>{{personexpedition.date_to}}</td>
+ </tr>
+{% endfor %}
+</table>
+</div>
+
+<div id="col1">
+<h3>Logbook entries</h3>
+<form action="" method="GET"><input type="submit" name="reload" value="Reload"></form>
+<p>debug message: {{message}}</p>
+
+<table class="expeditionlogbooks">
+<tr><th>Date</th><th>Title</th><th>Author</th><th>Place</th></tr>
+{% for logbookentry in logbookentries %}
+ <tr>
+ <td>{{logbookentry.date}}</td>
+ <td><a href="{{ logbookentry.get_absolute_url }}">{{logbookentry.title|safe}}</td>
+ <td><a href="{{ logbookentry.author.get_absolute_url }}">{{logbookentry.author.name}}</a></td>
+
+ {% if logbookentry.cave %}
+ <td><a href="{{ logbookentry.cave.get_absolute_url }}">{{logbookentry.place}}</a></td>
+ {% else %}
+ <td>{{logbookentry.place}}</td>
+ {% endif %}
+ </tr>
+{% endfor %}
+</table>
+</div>
+
+{% endblock %}
diff --git a/templates/logbookentry.html b/templates/logbookentry.html
index 613f2bf..2bfb564 100644
--- a/templates/logbookentry.html
+++ b/templates/logbookentry.html
@@ -4,23 +4,24 @@
{% block title %}Logbook {{logbookentry.id}}{% endblock %}
{% block content %}
+
<h2>{{logbookentry.title|safe}}</h2>
<div id="col2">
-<p><a href="{% url expedition logbookentry.expedition.year %}">{{logbookentry.expedition.name}}</a></p>
+<p><a href="{{ logbookentry.expedition.get_absolute_url }}">{{logbookentry.expedition.name}}</a></p>
{% if logbookentry.cave %}
- <p>place: <a href="{% url cave logbookentry.cave.href %}">{{logbookentry.place}}</p>
+ <p>place: <a href="{{ logbookentry.cave.get_absolute_url }}">{{logbookentry.place}}</p>
{% else %}
<p>{{logbookentry.place}}</p>
{% endif %}
<p>
{% if logbookentry.get_previous_by_date %}
- <a href="{% url logbookentry logbookentry.get_previous_by_date.href %}">{{logbookentry.get_previous_by_date.date}}</a>
+ <a href="{{ logbookentry.get_previous_by_date.get_absolute_url }}">{{logbookentry.get_previous_by_date.date}}</a>
{% endif %}
{% if logbookentry.get_next_by_date %}
- <a href="{% url logbookentry logbookentry.get_next_by_date.href %}">{{logbookentry.get_next_by_date.date}}</a>
+ <a href="{{ logbookentry.get_next_by_date.get_absolute_url }}">{{logbookentry.get_next_by_date.date}}</a>
{% endif %}
</p>
@@ -33,7 +34,7 @@
{% else %}
<td>
{% endifequal %}
- <a href="{% url personexpedition persontrip.person_expedition.person.href persontrip.person_expedition.expedition.year %}">{{persontrip.person_expedition.person}}</a>
+ <a href="{{ persontrip.person_expedition.get_absolute_url }}">{{persontrip.person_expedition.person}}</a>
</td>
<td>
@@ -44,12 +45,12 @@
<td>
{% if persontrip.get_previous_by_date %}
- <a href="{% url logbookentry persontrip.get_previous_by_date.logbook_entry.href %}">{{persontrip.get_previous_by_date.date}}</a>
+ <a href="{{ persontrip.get_previous_by_date.logbook_entry.get_absolute_url }}">{{persontrip.get_previous_by_date.date}}</a>
{% endif %}
</td>
<td>
{% if persontrip.get_next_by_date %}
- <a href="{% url logbookentry persontrip.get_next_by_date.logbook_entry.href %}">{{persontrip.get_next_by_date.date}}</a>
+ <a href="{{ persontrip.get_next_by_date.logbook_entry.get_absolute_url }}">{{persontrip.get_next_by_date.date}}</a>
{% endif %}
</td>
</tr>
diff --git a/templates/person.html b/templates/person.html
index 140aa8d..8f8c820 100644
--- a/templates/person.html
+++ b/templates/person.html
@@ -8,7 +8,7 @@
<p>{{person|wiki_to_html_short}} has been on expo in the following years:</p>
<p>
{% for personexpedition in person.personexpedition_set.all %}
- | <a href="{% url personexpedition personexpedition.person.href personexpedition.expedition.year %}">{{personexpedition.expedition.year}}</a>
+ | <a href="{{ personexpedition.get_absolute_url }}">{{personexpedition.expedition.year}}</a>
{% endfor %}
</p>
diff --git a/templates/personexpedition.html b/templates/personexpedition.html
index e1e481b..ca1080c 100644
--- a/templates/personexpedition.html
+++ b/templates/personexpedition.html
@@ -9,8 +9,8 @@
<h3>{{message}}</h3>
-<p><b><a href="{% url expedition personexpedition.expedition.year %}">Main page for expedition: {{personexpedition.expedition}}</a></b></p>
-<p><b><a href="{% url person personexpedition.person.href %}">Main page for person: {{personexpedition.person}}</a></b></p>
+<p><b><a href="{{ personexpedition.expedition.get_absolute_url }}">Main page for expedition: {{personexpedition.expedition}}</a></b></p>
+<p><b><a href="{{ personexpedition.person.get_absolute_url }}">Main page for person: {{personexpedition.person}}</a></b></p>
<p>List of other expos by this person</p>
<p>
@@ -18,7 +18,7 @@
{% ifequal otherpersonexpedition personexpedition %}
| <b>{{otherpersonexpedition.expedition.year}}</b>
{% else %}
- | <a href="{% url personexpedition personexpedition.person.href otherpersonexpedition.expedition.year %}">{{otherpersonexpedition.expedition.year}}</a>
+ | <a href="{{ personexpedition.get_absolute_url }}">{{otherpersonexpedition.expedition.year}}</a>
{% endifequal %}
{% endfor %}
</p>
@@ -35,10 +35,10 @@
<table>
{% for persontrip in persondate.1.persontrips %}
<tr>
- <td class="trip"><a href="{% url logbookentry persontrip.logbook_entry.href %}">{{persontrip.logbook_entry.title|safe}}</a></td>
+ <td class="trip"><a href="{{ persontrip.logbook_entry.get_absolute_url }}">{{persontrip.logbook_entry.title|safe}}</a></td>
{% if persontrip.logbook_entry.cave %}
- <td><a href="{% url cave persontrip.logbook_entry.cave.href %}">{{persontrip.place}}</a></td>
+ <td><a href="{{ persontrip.logbook_entry.cave.get_absolute_url }}">{{persontrip.place}}</a></td>
{% else %}
<td>{{persontrip.place}}</td>
{% endif %}
diff --git a/templates/personindex.html b/templates/personindex.html
index 5ffbe4d..e684ad8 100644
--- a/templates/personindex.html
+++ b/templates/personindex.html
@@ -10,9 +10,9 @@
<tr><th>Person</th><th>First</th><th>Last</th><th>Notability</th></tr>
{% for person in notablepersons %}
<tr>
- <td><a href="{% url person person.href%}">{{person|wiki_to_html_short}}</a></td>
- <td><a href="{% url personexpedition person.href person.Firstexpedition.expedition.year %}">{{person.Firstexpedition.expedition.year}}</a></td>
- <td><a href="{% url personexpedition person.href person.Lastexpedition.expedition.year %}">{{person.Lastexpedition.expedition.year}}</a></td>
+ <td><a href="{{ person.get_absolute_url }}">{{person|wiki_to_html_short}}</a></td>
+ <td><a href="{{ person.personexpedition_set.all.0.get_absolute_url }}">{{ person.personexpedition_set.all.0.expedition.year }}</a></td>
+ <td><a href="{{ person.personexpedition_set.latest.get_absolute_url }}">{{ person.personexpedition_set.latest.expedition.year }}</a></td>
<td>{{person.notability}}</td>
</tr>
{% endfor %}
@@ -28,9 +28,9 @@
<tr><th>Person</th><th>First</th><th>Last</th></tr>
{% for person in persons %}
<tr>
- <td><a href="{% url person person.href%}">{{person|wiki_to_html_short}}</a></td>
- <td><a href="{% url personexpedition person.href person.Firstexpedition.expedition.year %}">{{person.Firstexpedition.expedition.year}}</a></td>
- <td><a href="{% url personexpedition person.href person.Lastexpedition.expedition.year %}">{{person.Lastexpedition.expedition.year}}</a></td>
+ <td><a href="{{ person.get_absolute_url }}">{{person|wiki_to_html_short}}</a></td>
+ <td><a href="{{ person.personexpedition_set.all.0.get_absolute_url }}">{{person.personexpedition_set.all.0.expedition.year}}</a></td>
+ <td><a href="{{ person.personexpedition_set.latest.get_absolute_url }}">{{person.personexpedition_set.latest.expedition.year}}</a></td>
</tr>
{% endfor %}
</table>
diff --git a/templates/survey.html b/templates/survey.html
index 8f9e190..e2e8c80 100644
--- a/templates/survey.html
+++ b/templates/survey.html
@@ -85,7 +85,7 @@ select { margin:0.5em }
<center>
<select id="expeditionChooser" class="centre" onChange="redirectYear()">
- {% for expedition in expeditions.reverse %}
+ {% for expedition in expeditions %}
<option label="{{ expedition }}" value="{{ expedition }}" {% ifequal expedition current_expedition %}selected{% endifequal %}>
@@ -103,9 +103,9 @@ select { margin:0.5em }
survey progress table </div>
</div>
- <h3>Choose a wallet number</h3>
- <center>
- <select id="surveyChooser" class="centre" onChange="redirectSurvey()">
+ <h3>Choose a wallet number </h3>
+ <center>
+ <select id="surveyChooser" class="centre" onChange="redirectSurvey()">
<option label="show all" value="">
{% for survey in current_expedition.survey_set.all %}
</option>
@@ -113,6 +113,7 @@ select { margin:0.5em }
{% ifequal survey current_survey %}
selected
{% endifequal %}>
+ {{ survey }}
</option>
{% endfor %}
@@ -195,8 +196,9 @@ select { margin:0.5em }
</p>
</div>
{% endfor %}
- <div class="figure"> <a href="{{ settings.URL_ROOT }}admin/expo/scannedimage/add/"> <img src="{{ settings.URL_ROOT }}{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_addlink.gif" /> Add a new scanned notes page. </a> (to be improved) </div>
+ <div class="figure"> <a href="{{ settings.URL_ROOT }}admin/expo/scannedimage/add/"> <img src="{{ settings.URL_ROOT }}{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_addlink.gif" /> Add a new scanned notes page. </a> </div>
</div>
+ <br class="clearfloat" />
<div id="survexFileContent" class="behind"> survex file editor, keeping file in original structure <br />
who entered by </div>
<div id="printedCentrelineContent" class="behind"> centreline </div>
@@ -212,7 +214,7 @@ select { margin:0.5em }
</p>
</div>
{% endfor %}
- <div class="figure"> <a href="{{ settings.URL_ROOT }}admin/expo/scannedimage/add/"> <img src="{{ settings.URL_ROOT }}{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_addlink.gif" /> Add a new scanned notes page. </a> (to be improved) </div>
+ <div class="figure"> <a href="{{ settings.URL_ROOT }}admin/expo/scannedimage/add/"> <img src="{{ settings.URL_ROOT }}{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_addlink.gif" /> Add a new scanned sketch. </a> </div>
</div>
<div id="tunnelXMLfileContent" class="behind"> link to tunnel xml file. potentially instance of tunnel applet... </div>
<div id="mainSketchIntegrationContent" class="behind"> link to main sketch file </div>