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 | 268d69214d0fd61236da0b9df307cd4081f2ab58 (patch) | |
tree | d5001ac40c1f9d3fcf699e1c54b014693a5b6b17 /expo/views_caves.py | |
parent | 987bd56edd333a5f4b1eab407f75e9bd179abe19 (diff) | |
download | troggle-268d69214d0fd61236da0b9df307cd4081f2ab58.tar.gz troggle-268d69214d0fd61236da0b9df307cd4081f2ab58.tar.bz2 troggle-268d69214d0fd61236da0b9df307cd4081f2ab58.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 = ''
|