mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-26 17:21:52 +00:00
slug views, start of cave eidt form, cavelist splitting up by kataster area etc.
This commit is contained in:
parent
06efab7d73
commit
203719375e
@ -1,6 +1,9 @@
|
|||||||
from troggle.core.models import Cave, CaveAndEntrance, Survey, Expedition, QM, CaveDescription
|
from troggle.core.models import Cave, CaveAndEntrance, Survey, Expedition, QM, CaveDescription
|
||||||
|
from troggle.core.forms import CaveForm
|
||||||
import troggle.core.models as models
|
import troggle.core.models as models
|
||||||
import troggle.settings as settings
|
import troggle.settings as settings
|
||||||
|
from troggle.helper import login_required_if_public
|
||||||
|
|
||||||
from django.forms.models import formset_factory
|
from django.forms.models import formset_factory
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from utils import render_with_context # see views_logbooks for explanation on this.
|
from utils import render_with_context # see views_logbooks for explanation on this.
|
||||||
@ -21,15 +24,31 @@ def caveindex(request):
|
|||||||
caves = Cave.objects.all()
|
caves = Cave.objects.all()
|
||||||
notablecavehrefs = [ "161", "204", "258", "76" ] # could detect notability by trips and notability of people who have been down them
|
notablecavehrefs = [ "161", "204", "258", "76" ] # could detect notability by trips and notability of people who have been down them
|
||||||
notablecaves = [Cave.objects.get(kataster_number=kataster_number) for kataster_number in notablecavehrefs ]
|
notablecaves = [Cave.objects.get(kataster_number=kataster_number) for kataster_number in notablecavehrefs ]
|
||||||
return render_with_context(request,'caveindex.html', {'caves': caves, 'notablecaves':notablecaves})
|
caves1623 = Cave.objects.filter(area__short_name = "1623")
|
||||||
|
caves1626 = Cave.objects.filter(area__short_name = "1626")
|
||||||
|
return render_with_context(request,'caveindex.html', {'caves1623': caves1623, 'caves1626': caves1626, 'notablecaves':notablecaves, 'cavepage': True})
|
||||||
|
|
||||||
def cave(request, cave_id='', offical_name=''):
|
def cave(request, cave_id='', offical_name=''):
|
||||||
cave=getCave(cave_id)
|
cave=getCave(cave_id)
|
||||||
|
if cave.non_public and not request.user.is_authenticated():
|
||||||
|
return render_with_context(request,'nonpublic.html', {'instance': cave, 'cavepage': True})
|
||||||
|
else:
|
||||||
|
return render_with_context(request,'cave.html', {'cave': cave, 'cavepage': True})
|
||||||
|
|
||||||
|
def caveSlug(request, slug):
|
||||||
|
cave = Cave.objects.get(slug = slug)
|
||||||
if cave.non_public and not request.user.is_authenticated():
|
if cave.non_public and not request.user.is_authenticated():
|
||||||
return render_with_context(request,'nonpublic.html', {'instance': cave})
|
return render_with_context(request,'nonpublic.html', {'instance': cave})
|
||||||
else:
|
else:
|
||||||
return render_with_context(request,'cave.html', {'cave': cave})
|
return render_with_context(request,'cave.html', {'cave': cave})
|
||||||
|
|
||||||
|
@login_required_if_public
|
||||||
|
def editCave(request, slug=None):
|
||||||
|
form = CaveForm()
|
||||||
|
return render_with_context(request,
|
||||||
|
'editcave.html',
|
||||||
|
{'form': form})
|
||||||
|
|
||||||
def qm(request,cave_id,qm_id,year,grade=None):
|
def qm(request,cave_id,qm_id,year,grade=None):
|
||||||
year=int(year)
|
year=int(year)
|
||||||
try:
|
try:
|
||||||
@ -43,6 +62,7 @@ def qm(request,cave_id,qm_id,year,grade=None):
|
|||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def ent(request, cave_id, ent_letter):
|
def ent(request, cave_id, ent_letter):
|
||||||
cave = Cave.objects.filter(kataster_number = cave_id)[0]
|
cave = Cave.objects.filter(kataster_number = cave_id)[0]
|
||||||
cave_and_ent = CaveAndEntrance.objects.filter(cave = cave).filter(entrance_letter = ent_letter)[0]
|
cave_and_ent = CaveAndEntrance.objects.filter(cave = cave).filter(entrance_letter = ent_letter)[0]
|
||||||
@ -50,6 +70,13 @@ def ent(request, cave_id, ent_letter):
|
|||||||
'entrance': cave_and_ent.entrance,
|
'entrance': cave_and_ent.entrance,
|
||||||
'letter': cave_and_ent.entrance_letter,})
|
'letter': cave_and_ent.entrance_letter,})
|
||||||
|
|
||||||
|
def entranceSlug(request, slug):
|
||||||
|
entrance = Entrance.objects.get(slug = slug)
|
||||||
|
if entrance.non_public and not request.user.is_authenticated():
|
||||||
|
return render_with_context(request,'nonpublic.html', {'instance': entrance})
|
||||||
|
else:
|
||||||
|
return render_with_context(request,'entranceslug.html', {'entrance': entrance})
|
||||||
|
|
||||||
def survexblock(request, survexpath):
|
def survexblock(request, survexpath):
|
||||||
survexpath = re.sub("/", ".", survexpath)
|
survexpath = re.sub("/", ".", survexpath)
|
||||||
print "jjjjjj", survexpath
|
print "jjjjjj", survexpath
|
||||||
|
Loading…
Reference in New Issue
Block a user