From 57ede091c42878f11b33a2c77aa73a71bd4723dd Mon Sep 17 00:00:00 2001 From: substantialnoninfringinguser Date: Wed, 22 Jul 2009 16:18:00 +0100 Subject: [svn] Various bug fixes, using more raw_id fields in admin so it loads faster. I had to put onLoad="contentHeight();" back into the base template. This is a bad solution, I would rather use Martin's, but it wasn't working. --- core/views_other.py | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'core/views_other.py') diff --git a/core/views_other.py b/core/views_other.py index c2c82ee..e3ecb10 100644 --- a/core/views_other.py +++ b/core/views_other.py @@ -161,7 +161,7 @@ def logbook_entry_suggestions(request): Generates a html box with suggestions about what to do with QMs in logbook entry text. """ - unwiki_QM_pattern=r"(?P(?P[ABC]?)(?P\d*)-?(?P\d\d\d?\d?)-(?P\d\d)(?P[ABCDXV]?)(?=\s))" + unwiki_QM_pattern=r"(?P(?P[ABC]?)(?P\d*)-?(?P\d\d\d?\d?)-(?P\d\d)(?P[ABCDXV]?))" unwiki_QM_pattern=re.compile(unwiki_QM_pattern) #wikilink_QM_pattern=settings.QM_PATTERN @@ -174,18 +174,24 @@ def logbook_entry_suggestions(request): print unwiki_QMs for qm in unwiki_QMs: - if len(qm['year'])==2: - if int(qm['year'])<50: - qm['year']='20'+qm['year'] - else: - qm['year']='19'+qm['year'] - - temp_QM=QM(found_by=lbo,number=qm['number'],grade=qm['grade']) - try: - temp_QM.grade=unwiki_QM['grade'] - except: - pass - qm['wikilink']=temp_QM.wiki_link() + #try: + if len(qm['year'])==2: + if int(qm['year'])<50: + qm['year']='20'+qm['year'] + else: + qm['year']='19'+qm['year'] + + if lbo.date.year!=int(qm['year']): + try: + lbo=LogbookEntry.objects.get(date__year=qm['year'],title__icontains="placeholder for QMs in") + except: + print "failed to get placeholder for year "+str(qm['year']) + + temp_QM=QM(found_by=lbo,number=qm['number'],grade=qm['grade']) + temp_QM.grade=qm['grade'] + qm['wikilink']=temp_QM.wiki_link() + #except: + #print 'failed' print unwiki_QMs -- cgit v1.2.3