[svn r8226] I initial work at adding caveareas. (Descirprion of parts of caves)

This commit is contained in:
julian 2009-01-24 19:49:51 +01:00
parent ca9188bf69
commit af65239d6e
7 changed files with 56 additions and 27 deletions

View File

@ -363,6 +363,14 @@ class Entrance(models.Model):
if f[0] == self.findability:
return f[1]
class CaveArea(models.Model):
description = models.TextField()
name = models.CharField(max_length=200, unique = True)
cave = models.ForeignKey('Cave')
parentArea = models.ForeignKey('CaveArea')
survexFile = models.CharField(max_length=200)
class QM(models.Model):
#based on qm.csv in trunk/expoweb/smkridge/204 which has the fields:
#"Number","Grade","Area","Description","Page reference","Nearest station","Completion description","Comment"

View File

@ -27,6 +27,11 @@ def survexblock(request, survexpath):
ftext = survexblock.text
return render_to_response('survexblock.html', {'survexblock':survexblock, 'ftext':ftext, 'settings':settings })
def caveArea(request, name):
cavearea = models.CaveArea.objects.get(name = name)
cave = cavearea.cave
return render_to_response('cavearea.html', {'cavearea': cavearea, 'cave': cave, 'settings':settings })
def caveSearch(request):
query_string = ''
found_entries = None

View File

@ -35,6 +35,8 @@
<div id="content" >
{% block contentheader %}
{% endblock %}
{% block content %}
REPLACE : The content
{% endblock %}

View File

@ -1,31 +1,7 @@
{% extends "base.html" %}
{% extends "cavebase.html" %}
{% load wiki_markup %}
{% block title %}{{ cave.official_name|wiki_to_html }}{% endblock %}
{% block content %}
<table id="cavepage">
<tr>
<th id="kat_no">
{% if cave.kataster_number %}
{{ cave.kataster_number|wiki_to_html_short }}
{% if cave.entrancelist %}
- {{ cave.entrancelist|wiki_to_html_short }}
{% endif %}
{% if cave.unofficial_number %}
<br />({{ cave.unofficial_number|wiki_to_html_short }})
{% endif %}
{% endif %}
</th>
<th id="name">
{{ cave.official_name|wiki_to_html_short }}
</th>
<th id="status">
{{ cave.kataster_code|wiki_to_html_short }}
</th>
</tr>
</table>
{% if cave.entrances %}
<h2>Entrances</h2>
{% for ent in cave.entrances %}

View File

@ -0,0 +1,9 @@
{% extends "cavebase.html" %}
{% load wiki_markup %}
{% block content %}
{{ cavearea.description }}
{{ cavearea.name }}
{{ cavearea.parentArea }}
{{ cavearea.survexFile }}
{% endblock %}

View File

@ -0,0 +1,28 @@
{% extends "base.html" %}
{% load wiki_markup %}
{% block title %}{{ cave.official_name|wiki_to_html }}{% endblock %}
{% block contentheader %}
<table id="cavepage">
<tr>
<th id="kat_no">
{% if cave.kataster_number %}
{{ cave.kataster_number|wiki_to_html_short }}
{% if cave.entrancelist %}
- {{ cave.entrancelist|wiki_to_html_short }}
{% endif %}
{% if cave.unofficial_number %}
<br />({{ cave.unofficial_number|wiki_to_html_short }})
{% endif %}
{% endif %}
</th>
<th id="name">
{{ cave.official_name|wiki_to_html_short }}
</th>
<th id="status">
{{ cave.kataster_code|wiki_to_html_short }}
</th>
</tr>
</table>
{% endblock %}

View File

@ -14,6 +14,7 @@ urlpatterns = patterns('',
(r'^cave/(?P<cave_id>[^/]+)/?(?P<ent_letter>[^/])$', ent),
#(r'^cave/(?P<cave_id>[^/]+)/edit/$', edit_cave),
(r'^cavesearch', caveSearch),
url(r'^cavearea', caveArea, name="caveArea"),
url(r'^survex/(.*?)\.index$', index, name="survexindex"),
(r'^survex/(?P<survex_file>.*)\.svx$', svx),