mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-16 17:47:07 +00:00
[svn] Initial and poor attempt at a view for cave descriptions.
This commit is contained in:
@@ -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.core.models as models
|
||||||
import troggle.settings as settings
|
import troggle.settings as settings
|
||||||
from django.forms.models import formset_factory
|
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.http import HttpResponseRedirect
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
import re, urlparse
|
import re, urlparse
|
||||||
|
from django.shortcuts import get_object_or_404
|
||||||
|
|
||||||
def getCave(cave_id):
|
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."""
|
"""Returns a cave object when given a cave name or number. It is used by views including cavehref, ent, and qm."""
|
||||||
@@ -85,3 +86,8 @@ def survey(request,year,wallet_number):
|
|||||||
elevationSketches=current_survey.scannedimage_set.filter(contents='elevation')
|
elevationSketches=current_survey.scannedimage_set.filter(contents='elevation')
|
||||||
|
|
||||||
return render_with_context(request,'survey.html', locals())
|
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())
|
||||||
20
templates/cave_description.html
Normal file
20
templates/cave_description.html
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{% extends "cavebase.html" %}
|
||||||
|
{% load wiki_markup %}
|
||||||
|
{% load mptt_tags %}
|
||||||
|
{% block title %} {{cave_description.short_name}} {% endblock title %}
|
||||||
|
{% block editLink %}<a href={{cave_description.get_admin_url}}>Edit description {{cave_description}}</a>{% endblock %}
|
||||||
|
|
||||||
|
{% block contentheader %}
|
||||||
|
{{cave_description.long_name}}
|
||||||
|
{% endblock contentheader %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<h1>{{cave_description.long_name}}</h1>
|
||||||
|
<p>
|
||||||
|
{{cave_description.description|wiki_to_html}}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{% endblock content %}
|
||||||
1
urls.py
1
urls.py
@@ -30,6 +30,7 @@ urlpatterns = patterns('',
|
|||||||
|
|
||||||
url(r'^survexblock/(.+)$', views_caves.survexblock, name="survexblock"),
|
url(r'^survexblock/(.+)$', views_caves.survexblock, name="survexblock"),
|
||||||
url(r'^cave/(?P<cave_id>[^/]+)/?$', views_caves.cave, name="cave"),
|
url(r'^cave/(?P<cave_id>[^/]+)/?$', views_caves.cave, name="cave"),
|
||||||
|
url(r'^cavedescription/(?P<cavedescription_name>[^/]*)/$', views_caves.cave_description, name="cavedescription"),
|
||||||
#url(r'^cavehref/(.+)$', views_caves.cave, name="cave"),url(r'cave'),
|
#url(r'^cavehref/(.+)$', views_caves.cave, name="cave"),url(r'cave'),
|
||||||
|
|
||||||
url(r'^jgtfile/(.*)$', view_surveys.jgtfile, name="jgtfile"),
|
url(r'^jgtfile/(.*)$', view_surveys.jgtfile, name="jgtfile"),
|
||||||
|
|||||||
Reference in New Issue
Block a user