[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

@ -362,6 +362,14 @@ class Entrance(models.Model):
for f in self.FINDABLE_CHOICES: for f in self.FINDABLE_CHOICES:
if f[0] == self.findability: if f[0] == self.findability:
return f[1] 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): class QM(models.Model):
#based on qm.csv in trunk/expoweb/smkridge/204 which has the fields: #based on qm.csv in trunk/expoweb/smkridge/204 which has the fields:

View File

@ -27,6 +27,11 @@ def survexblock(request, survexpath):
ftext = survexblock.text ftext = survexblock.text
return render_to_response('survexblock.html', {'survexblock':survexblock, 'ftext':ftext, 'settings':settings }) 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): def caveSearch(request):
query_string = '' query_string = ''
found_entries = None found_entries = None

View File

@ -34,8 +34,10 @@
<div id="content" > <div id="content" >
{% block content %} {% block contentheader %}
{% endblock %}
{% block content %}
REPLACE : The content REPLACE : The content
{% endblock %} {% endblock %}
<br class="clearfloat" /> <!--This is to ensure that the content div expands around floated objects*/--> <br class="clearfloat" /> <!--This is to ensure that the content div expands around floated objects*/-->

View File

@ -1,31 +1,7 @@
{% extends "base.html" %} {% extends "cavebase.html" %}
{% load wiki_markup %} {% load wiki_markup %}
{% block title %}{{ cave.official_name|wiki_to_html }}{% endblock %}
{% block content %} {% 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 %} {% if cave.entrances %}
<h2>Entrances</h2> <h2>Entrances</h2>
{% for ent in cave.entrances %} {% 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>[^/]+)/?(?P<ent_letter>[^/])$', ent),
#(r'^cave/(?P<cave_id>[^/]+)/edit/$', edit_cave), #(r'^cave/(?P<cave_id>[^/]+)/edit/$', edit_cave),
(r'^cavesearch', caveSearch), (r'^cavesearch', caveSearch),
url(r'^cavearea', caveArea, name="caveArea"),
url(r'^survex/(.*?)\.index$', index, name="survexindex"), url(r'^survex/(.*?)\.index$', index, name="survexindex"),
(r'^survex/(?P<survex_file>.*)\.svx$', svx), (r'^survex/(?P<survex_file>.*)\.svx$', svx),