[svn] Use template block "related" for related objects. Various cleanup, fix personexpedition date views.

This commit is contained in:
substantialnoninfringinguser 2009-07-03 00:50:56 +01:00
parent dab138c731
commit a89139763f
11 changed files with 56 additions and 69 deletions

View File

@ -180,7 +180,7 @@ class PersonExpedition(TroggleModel):
def GetPersonChronology(self):
res = { }
for persontrip in self.persontrip_set.all():
a = res.setdefault(persontrip.date, { })
a = res.setdefault(persontrip.date(), { })
a.setdefault("persontrips", [ ]).append(persontrip)
for personrole in self.personrole_set.all():
a = res.setdefault(personrole.survex_block.date, { })
@ -236,7 +236,7 @@ class PersonExpedition(TroggleModel):
class LogbookEntry(TroggleModel):
date = models.DateField()
expedition = models.ForeignKey(Expedition,blank=True,null=True) # yes this is double-
author = models.ForeignKey(PersonExpedition,blank=True,null=True) # the person who writes it up doesn't have to have been on the trip.
= models.ForeignKey(PersonExpedition,blank=True,null=True) # the person who writes it up doesn't have to have been on the trip.
# Re: the above- so this field should be "typist" or something, not "author". - AC 15 jun 09
title = models.CharField(max_length=200)
cave = models.ForeignKey('Cave',blank=True,null=True)
@ -287,9 +287,6 @@ class PersonTrip(TroggleModel):
else:
return self.logbook_entry.place
#persontrip_next = models.ForeignKey('PersonTrip', related_name='pnext', blank=True,null=True)
#persontrip_prev = models.ForeignKey('PersonTrip', related_name='pprev', blank=True,null=True)
def __unicode__(self):
return "%s %s (%s)" % (self.person_expedition, self.place(), self.date())

View File

@ -405,6 +405,11 @@ div#related
color:#666666;
}
div#related table
{
border-collapse:separate
}
.addlink {
padding-left: 12px;
background: url(../icon_addlink.gif) 0 .2em no-repeat;

View File

@ -13,7 +13,7 @@
{% block head %}{% endblock %}
</head>
<body>
<body onLoad="contentHeight();">
<div id="header">
<h1>CUCC Expeditions to Austria: 1976 - 2009</h1>
@ -38,12 +38,18 @@
{% endblock %}
</div>
<div id="content" >
<div id="content" >
{% block contentheader %}
{% endblock %}
<div id="related">
{% block related %}
{% endblock %}
</div>
{% block content %}
REPLACE : The content
{% endblock %}

View File

@ -1,10 +1,9 @@
{% extends "cavebase.html" %}
{% load wiki_markup %}
{% block editLink %}| <a href={{cave.get_admin_url}}>Edit cave {{cave|wiki_to_html_short}}</a>{% endblock %}
{% block content %}
<div id="col2">
<h3>All logbook entries regarding this cave ({{cave.logbookentry_set.count}})</h3>
{% block related %}
<h2>All logbook entries regarding this cave ({{cave.logbookentry_set.count}})</h2>
<table>
{% for logbookentry in cave.logbookentry_set.all %}
{% if logbookentry.title %}
@ -15,7 +14,9 @@
{% endif %}
{% endfor %}
</table>
</div>
{% endblock %}
{% block content %}
{% if cave.entrances %}
<h2>Entrances</h2>

View File

@ -1,16 +1,15 @@
{% extends "base.html" %}
{% load wiki_markup %}
{% load link %}
{% block title %}Expedition {{expedition.name}}{% endblock %}
{% block editLink %}<a href={{expedition.get_admin_url}}>Edit expedition {{expedition|wiki_to_html_short}}</a>{% endblock %}
{% block content %}
<h2>{{expedition.name}}: {{expedition.date_from}} - {{expedition.date_to}}</h2>
<div id="col2">
{% block related %}
<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>
<td>{% if expedition_prev %}&lt; &lt; {{ expedition_prev|link }} {% endif %}</td>
<td>{% if expedition_next %}&gt; &gt; {{ expedition_next|link }} {% endif %}</td>
</tr>
</ul>
@ -24,7 +23,11 @@
</tr>
{% endfor %}
</table>
</div>
{% endblock %}
{% block content %}
<h2>{{expedition.name}}: {{expedition.date_from}} - {{expedition.date_to}}</h2>
<div id="col1">
<h3>Logbook entries</h3>

View File

@ -3,11 +3,7 @@
{% block title %}Cambridge Expeditions to Austria{% endblock %}
{% block content %}
<div id="related">
{% block related %}
<h2>Recent Actions</h2>
{% load log %}
{% get_admin_log 10 as admin_log %}
@ -32,7 +28,11 @@
{% endfor %}
</ul>
{% endif %}
</div>
{% endblock %}
{% block content %}
<div id="col1">

View File

@ -7,7 +7,7 @@
<h2>{{logbookentry.title|safe}}</h2>
<div id="col2">
<div id="related">
<p><a href="{{ logbookentry.expedition.get_absolute_url }}">{{logbookentry.expedition.name}}</a></p>
{% if logbookentry.cave %}

View File

@ -1,21 +0,0 @@
{% extends "base.html" %}
{% load wiki_markup %}
{% block title %}Logbook search results for "{{ query_string }}"{% endblock%}
{% block content %}
<h1> Troggle logbook search </h1>
<p>Your search string, <b>{{ query_string }}</b>,
{% if found_entries %}
was found in the following <b>{{entry.count}}</b> logbook titles and / or entries:</p>
<ul>
{% for entry in found_entries %}
<li><a href="{{ settings.URL_ROOT }}logbookentry/{{ entry.pk }}">{{ entry|wiki_to_html_short }} </a></li>
{% endfor %}
</ul>
{% else %}
was not found in any logbook titles and / or entries. Please try again.
{% endif %}
{% endblock %}

View File

@ -1,5 +1,6 @@
{% extends "base.html" %}
{% load wiki_markup %}
{% load link %}
{% block title %}Person {{personexpedition.person|wiki_to_html_short}} for {{personexpedition.expedition}}{% endblock %}
@ -18,7 +19,7 @@
{% ifequal otherpersonexpedition personexpedition %}
| <b>{{otherpersonexpedition.expedition.year}}</b>
{% else %}
| <a href="{{ otherpersonexpedition.get_absolute_url }}">{{otherpersonexpedition.expedition.year}}</a>
| {{ otherpersonexpedition|link }}
{% endifequal %}
{% endfor %}
</p>

View File

@ -18,18 +18,14 @@
</table>
{% endblock %}
{% block content %}
{% block related %}
<div id="col2">
<h2>Related items</h2>
{% endblock %}
<h2>Related items</h2>
Parent cave: {{qm.found_by.cave|link}}
(todo: add parent survey and parent subcave)
</div>
{% block content %}
<h3>Location</h3>
{{qm.location_description}}

View File

@ -11,20 +11,7 @@
{% block content %}
ok here comes the drilldown<br />
{% drilldown_tree_for_node subcave as drilldown %}
{% for each in drilldown %}
{{ each }}>
{% endfor %}
<h2>{{subcave}}</h2>
<p>
{{subcave.description}}
</p>
<div id="col2">
{% block related %}
<h2>Related places</h2>
@ -55,6 +42,18 @@ ok here comes the drilldown<br />
</ul>
</div>
{% endblock %}
ok here comes the drilldown<br />
{% drilldown_tree_for_node subcave as drilldown %}
{% for each in drilldown %}
{{ each }}>
{% endfor %}
<h2>{{subcave}}</h2>
<p>
{{subcave.description}}
</p>
{% endblock content %}