diff --git a/core/views_caves.py b/core/views_caves.py index af91742..fde7bbb 100644 --- a/core/views_caves.py +++ b/core/views_caves.py @@ -1,4 +1,4 @@ -from troggle.core.models import Cave, CaveAndEntrance, Survey, Expedition, QM +from troggle.core.models import Cave, CaveAndEntrance, Survey, Expedition, QM, CaveDescription import troggle.core.models as models import troggle.settings as settings from django.forms.models import formset_factory @@ -7,6 +7,7 @@ from utils import render_with_context # see views_logbooks for explanation on th from django.http import HttpResponseRedirect from django.conf import settings import re, urlparse +from django.shortcuts import get_object_or_404 def getCave(cave_id): """Returns a cave object when given a cave name or number. It is used by views including cavehref, ent, and qm.""" @@ -83,5 +84,10 @@ def survey(request,year,wallet_number): notes=current_survey.scannedimage_set.filter(contents='notes') planSketches=current_survey.scannedimage_set.filter(contents='plan') elevationSketches=current_survey.scannedimage_set.filter(contents='elevation') - + return render_with_context(request,'survey.html', locals()) + +def cave_description(request, cavedescription_name): + cave_description = get_object_or_404(CaveDescription, short_name = cavedescription_name) + print cave_description.long_name + return render_with_context(request,'cave_description.html', locals()) \ No newline at end of file diff --git a/templates/cave_description.html b/templates/cave_description.html new file mode 100644 index 0000000..f41d9fd --- /dev/null +++ b/templates/cave_description.html @@ -0,0 +1,20 @@ +{% extends "cavebase.html" %} +{% load wiki_markup %} +{% load mptt_tags %} +{% block title %} {{cave_description.short_name}} {% endblock title %} +{% block editLink %}Edit description {{cave_description}}{% endblock %} + +{% block contentheader %} + {{cave_description.long_name}} +{% endblock contentheader %} + + + +{% block content %} + +
+ {{cave_description.description|wiki_to_html}} +
+ +{% endblock content %} \ No newline at end of file diff --git a/urls.py b/urls.py index e6dcaa5..0123080 100644 --- a/urls.py +++ b/urls.py @@ -27,14 +27,15 @@ urlpatterns = patterns('', url(r'^expeditions/?$', object_list, {'queryset':Expedition.objects.all(),'template_name':'object_list.html'},name="expeditions"), url(r'^personexpedition/(?P