diff --git a/expo/models.py b/expo/models.py index 50140aa..058fff5 100644 --- a/expo/models.py +++ b/expo/models.py @@ -362,6 +362,14 @@ class Entrance(models.Model): for f in self.FINDABLE_CHOICES: 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: diff --git a/expo/views_caves.py b/expo/views_caves.py index 4e691e5..691dd43 100644 --- a/expo/views_caves.py +++ b/expo/views_caves.py @@ -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 diff --git a/templates/base.html b/templates/base.html index 5357af1..b1fc47f 100644 --- a/templates/base.html +++ b/templates/base.html @@ -34,8 +34,10 @@ -
-{% block content %} +
+{% block contentheader %} +{% endblock %} +{% block content %} REPLACE : The content {% endblock %}
diff --git a/templates/cave.html b/templates/cave.html index e76c3b8..24c0101 100644 --- a/templates/cave.html +++ b/templates/cave.html @@ -1,31 +1,7 @@ -{% extends "base.html" %} +{% extends "cavebase.html" %} {% load wiki_markup %} -{% block title %}{{ cave.official_name|wiki_to_html }}{% endblock %} - {% block content %} - - - - - - -
- {% 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 %} -
({{ cave.unofficial_number|wiki_to_html_short }}) - {% endif %} - {% endif %} -
- {{ cave.official_name|wiki_to_html_short }} - - {{ cave.kataster_code|wiki_to_html_short }} -
- {% if cave.entrances %}

Entrances

{% for ent in cave.entrances %} diff --git a/templates/cavearea.html b/templates/cavearea.html new file mode 100644 index 0000000..9049225 --- /dev/null +++ b/templates/cavearea.html @@ -0,0 +1,9 @@ +{% extends "cavebase.html" %} +{% load wiki_markup %} + +{% block content %} +{{ cavearea.description }} +{{ cavearea.name }} +{{ cavearea.parentArea }} +{{ cavearea.survexFile }} +{% endblock %} \ No newline at end of file diff --git a/templates/cavebase.html b/templates/cavebase.html new file mode 100644 index 0000000..f546ebf --- /dev/null +++ b/templates/cavebase.html @@ -0,0 +1,28 @@ +{% extends "base.html" %} +{% load wiki_markup %} + +{% block title %}{{ cave.official_name|wiki_to_html }}{% endblock %} + +{% block contentheader %} + + + + + + +
+ {% 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 %} +
({{ cave.unofficial_number|wiki_to_html_short }}) + {% endif %} + {% endif %} +
+ {{ cave.official_name|wiki_to_html_short }} + + {{ cave.kataster_code|wiki_to_html_short }} +
+{% endblock %} \ No newline at end of file diff --git a/urls.py b/urls.py index 1f10ecb..251fb73 100644 --- a/urls.py +++ b/urls.py @@ -14,6 +14,7 @@ urlpatterns = patterns('', (r'^cave/(?P[^/]+)/?(?P[^/])$', ent), #(r'^cave/(?P[^/]+)/edit/$', edit_cave), (r'^cavesearch', caveSearch), + url(r'^cavearea', caveArea, name="caveArea"), url(r'^survex/(.*?)\.index$', index, name="survexindex"), (r'^survex/(?P.*)\.svx$', svx),