From b979bdb5609394902d7b727c7e27f249d4f953f3 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Fri, 23 Apr 2021 16:31:52 +0100 Subject: [PATCH] slug too long for field --- core/utils.py | 2 +- parsers/logbooks.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/utils.py b/core/utils.py index bf7cb28..ff5f35c 100644 --- a/core/utils.py +++ b/core/utils.py @@ -77,7 +77,7 @@ def save_carefully(objectType, lookupAttribs={}, nonLookupAttribs={}): try: instance, created = objectType.objects.get_or_create(defaults=nonLookupAttribs, **lookupAttribs) except: - print(" !! - SAVE CAREFULLY ===================", objectType) + print(" !! - FAIL in SAVE CAREFULLY ===================", objectType) print(" !! - -- objects.get_or_create()") print(" !! - lookupAttribs:{}\n !! - nonLookupAttribs:{}".format(lookupAttribs,nonLookupAttribs)) raise diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 6a156af..c9d7796 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -128,8 +128,8 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_ # 'cave' is converted to a string doing this, which renders as the cave slug. # but it is a db query which we should try to avoid - rewrite this - #NEW sluf for a logbook entry here! Use the unique id, not the title !!! - slug = tid + slugify(title)[:50] + #NEW slug for a logbook entry here! Use the unique id, not the title !!! + slug = tid + "." + slugify(title)[:10] nonLookupAttribs={'place':place, 'text':text, 'expedition':expedition, 'cave_slug':str(cave), 'slug': slug, 'entry_type':entry_type} lbo, created=save_carefully(LogbookEntry, lookupAttribs, nonLookupAttribs) @@ -608,14 +608,14 @@ def LoadLogbooks(): if len(expos) <= 1: print(" ! No expeditions found. Load 'people' first.\n") nologbook = ["1976", "1977", "1978", "1979", "1980", "1981", - "1982", "1983", "1984", "1985", "1987", "1988", "1989", + "1987", "1988", "1989", "1986", "2020",] entries = {"2021": 0, "2019": 20, "2018": 74, "2017": 60, "2016": 81, "2015": 79, "2014": 65, "2013": 51, "2012": 75, "2011": 68, "2010": 22, "2009": 52, "2008": 49, "2007": 111, "2006": 60, "2005": 55, "2004": 76, "2003": 40, "2002": 31, "2001": 48, "2000": 54, "1999": 79, "1998": 43, "1997": 53, "1996": 94, "1995": 41, "1994": 32, "1993": 41, "1992": 61, "1991": 38, "1990": 87, "1989": 1,"1988": 1,"1987": 1, - "1985": 1,"1984": 1,"1983": 1,"1982": 42,} + "1985": 21,"1984": 19,"1983": 22,"1982": 42,} # Logbooks log.htm exist for 1983, 84, 85, 87, 88, 89 but have no full-working parser, or need hand-editing. try: os.remove("loadlogbk.log")