diff options
author | substantialnoninfringinguser <substantialnoninfringinguser@gmail.com> | 2009-05-13 06:08:04 +0100 |
---|---|---|
committer | substantialnoninfringinguser <substantialnoninfringinguser@gmail.com> | 2009-05-13 06:08:04 +0100 |
commit | 157f11b65900f7f36c7d9a060c8162c4250d584a (patch) | |
tree | fa271a36876e30341e2708707e05211f11b46631 /expo/views_logbooks.py | |
parent | 256de6e083926d526b419e4c698465b9bb2d7e21 (diff) | |
download | troggle-157f11b65900f7f36c7d9a060c8162c4250d584a.tar.gz troggle-157f11b65900f7f36c7d9a060c8162c4250d584a.tar.bz2 troggle-157f11b65900f7f36c7d9a060c8162c4250d584a.zip |
[svn] Added QM wiki markup. The format is [[cave:204 QM:2005-04A]] with the grade (A) being optional. The links color red if the QM does not exist, and in that case clicking on them goes to an admin add page with fields prepopulated.
Various other little things, e.g. filled in the footer with links.
Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8305 by aaron @ 3/16/2009 8:53 AM
Diffstat (limited to 'expo/views_logbooks.py')
-rw-r--r-- | expo/views_logbooks.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/expo/views_logbooks.py b/expo/views_logbooks.py index fae7491..cfc5d2f 100644 --- a/expo/views_logbooks.py +++ b/expo/views_logbooks.py @@ -71,7 +71,18 @@ def personexpedition(request, first_name='', last_name='', year=''): def logbookentry(request, logbookentry_pk):
logbookentry = LogbookEntry.objects.get(pk = logbookentry_pk)
- return render_response(request, 'logbookentry.html', {'logbookentry': logbookentry, })
+ logsforcave=logbookentry.cave.logbookentry_set.all()
+ biggestQMnumber=0
+ for log in logsforcave:
+ try:
+ biggestQMnumberInLog = logbookentry.QMs_found.order_by('-number')[0].number
+ except IndexError:
+ biggestQMnumberInLog = 0
+ if biggestQMnumberInLog > biggestQMnumber:
+ biggestQMnumber = biggestQMnumberInLog
+ nextQMnumber=biggestQMnumber+1
+ newQMlink=settings.URL_ROOT + r'/admin/expo/qm/add/?' + r'found_by=' + str(logbookentry.pk) +'&number=' + str(nextQMnumber)
+ return render_response(request, 'logbookentry.html', {'logbookentry': logbookentry, 'newQMlink':newQMlink})
def logbookSearch(request, extra):
query_string = ''
|