From d61c2b20c832557b4ce65df53bc94c6c1bd1ef65 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sun, 2 Aug 2020 23:53:35 +0100 Subject: Deleted archaisms and new comments --- core/views_other.py | 94 ++++++++++++++++++++++++++--------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'core/views_other.py') diff --git a/core/views_other.py b/core/views_other.py index 10c1ec7..cc8fe3a 100644 --- a/core/views_other.py +++ b/core/views_other.py @@ -128,62 +128,62 @@ def ajax_QM_number(request): return HttpResponse(res) -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]?))" - unwiki_QM_pattern=re.compile(unwiki_QM_pattern) - #wikilink_QM_pattern=settings.QM_PATTERN +# 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]?))" + # unwiki_QM_pattern=re.compile(unwiki_QM_pattern) + # #wikilink_QM_pattern=settings.QM_PATTERN - slug=request.POST['slug'] - date=request.POST['date'] - lbo=LogbookEntry.objects.get(slug=slug, date=date) + # slug=request.POST['slug'] + # date=request.POST['date'] + # lbo=LogbookEntry.objects.get(slug=slug, date=date) - #unwiki_QMs=re.findall(unwiki_QM_pattern,lbo.text) - unwiki_QMs=[m.groupdict() for m in unwiki_QM_pattern.finditer(lbo.text)] + # #unwiki_QMs=re.findall(unwiki_QM_pattern,lbo.text) + # unwiki_QMs=[m.groupdict() for m in unwiki_QM_pattern.finditer(lbo.text)] - print(unwiki_QMs) - for qm in unwiki_QMs: - #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']))) + # print(unwiki_QMs) + # for qm in unwiki_QMs: + # #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' + # 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) + # print(unwiki_QMs) - #wikilink_QMs=re.findall(wikilink_QM_pattern,lbo.text) - attached_QMs=lbo.QMs_found.all() - unmentioned_attached_QMs=''#not implemented, fill this in by subtracting wiklink_QMs from attached_QMs + # #wikilink_QMs=re.findall(wikilink_QM_pattern,lbo.text) + # attached_QMs=lbo.QMs_found.all() + # unmentioned_attached_QMs=''#not implemented, fill this in by subtracting wiklink_QMs from attached_QMs - #Find unattached_QMs. We only look at the QMs with a proper wiki link. - #for qm in wikilink_QMs: - #Try to look up the QM. + # #Find unattached_QMs. We only look at the QMs with a proper wiki link. + # #for qm in wikilink_QMs: + # #Try to look up the QM. - print('got 208') - any_suggestions=True - print('got 210') - return render(request,'suggestions.html', - { - 'unwiki_QMs':unwiki_QMs, - 'any_suggestions':any_suggestions - }) + # print('got 208') + # any_suggestions=True + # print('got 210') + # return render(request,'suggestions.html', + # { + # 'unwiki_QMs':unwiki_QMs, + # 'any_suggestions':any_suggestions + # }) print(" - newFile() is next in troggle/core/views_other.py") -- cgit v1.2.3