slug too long for field

This commit is contained in:
Philip Sargent 2021-04-23 16:31:52 +01:00
parent b7659a477c
commit b979bdb560
2 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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")