diff options
author | substantialnoninfringinguser <substantialnoninfringinguser@gmail.com> | 2009-05-13 06:28:36 +0100 |
---|---|---|
committer | substantialnoninfringinguser <substantialnoninfringinguser@gmail.com> | 2009-05-13 06:28:36 +0100 |
commit | 0f64e786b5f55895c054c4a377e7fc8672ca47b6 (patch) | |
tree | 4ff84e941581d3d331360262b34fdb306deb504d /expo/views_caves.py | |
parent | 7164296c9da927695df2b65cbfec990dd5f39ba2 (diff) | |
download | troggle-0f64e786b5f55895c054c4a377e7fc8672ca47b6.tar.gz troggle-0f64e786b5f55895c054c4a377e7fc8672ca47b6.tar.bz2 troggle-0f64e786b5f55895c054c4a377e7fc8672ca47b6.zip |
[svn] Made the subcaves work! Now we just have to figure out how to parse them...
Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8343 by cucc @ 5/11/2009 6:36 AM
Diffstat (limited to 'expo/views_caves.py')
-rw-r--r-- | expo/views_caves.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/expo/views_caves.py b/expo/views_caves.py index 1e11602..691cdcb 100644 --- a/expo/views_caves.py +++ b/expo/views_caves.py @@ -54,15 +54,16 @@ def survexblock(request, survexpath): def subcave(request, cave_id, subcave):
print subcave
- subcaveSeq=re.findall('([a-zA-Z]*)(?:/)',subcave)
+ subcaveSeq=re.findall('(?:/)([^/]*)',subcave)
print subcaveSeq
- cave=models.Cave.objects.filter(kataster_number = cave_id)[0]
+ cave=models.Cave.objects.get(kataster_number = cave_id)
subcave=models.Subcave.objects.get(name=subcaveSeq[0], cave=cave)
if len(subcaveSeq)>1:
- for singleSubcave in subcaveSeq[1:]:
- subcave=subcave.subcave_set.get(name=singleSubcave)
+ for subcaveUrlSegment in subcaveSeq[1:]:
+ if subcaveUrlSegment:
+ subcave=subcave.children.get(name=subcaveUrlSegment)
print subcave
- return render_response(request,'subcave.html', {'subcave': subcave,})
+ return render_response(request,'subcave.html', {'subcave': subcave,'cave':cave})
def caveSearch(request):
query_string = ''
|