mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 16:51:54 +00:00
[svn] Initial and poor attempt at a view for cave descriptions.
This commit is contained in:
parent
aa26690e33
commit
7fc1602f7a
@ -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())
|
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 %}
|
5
urls.py
5
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<first_name>[A-Z]*[a-z]*)[^a-zA-Z]*(?P<last_name>[A-Z]*[a-z]*)/(?P<year>\d+)/?$', views_logbooks.personexpedition, name="personexpedition"),
|
||||
url(r'^logbookentry/(?P<date>.*)/(?P<slug>.*)/?$', views_logbooks.logbookentry,name="logbookentry"),
|
||||
|
||||
|
||||
url(r'^survexblock/(.+)$', views_caves.survexblock, name="survexblock"),
|
||||
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'^jgtfile/(.*)$', view_surveys.jgtfile, name="jgtfile"),
|
||||
url(r'^jgtuploadfile$', view_surveys.jgtuploadfile, name="jgtuploadfile"),
|
||||
|
||||
|
||||
url(r'^cave/(?P<cave_id>[^/]+)/?(?P<ent_letter>[^/])$', ent),
|
||||
#(r'^cave/(?P<cave_id>[^/]+)/edit/$', edit_cave),
|
||||
#(r'^cavesearch', caveSearch),
|
||||
|
Loading…
Reference in New Issue
Block a user