2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 21:07:12 +00:00

dwg upload and django admin extra search

This commit is contained in:
Philip Sargent
2021-05-05 00:35:10 +01:00
parent 44b6770b6a
commit d374779c47
13 changed files with 333 additions and 239 deletions

View File

@@ -432,7 +432,7 @@ class LogbookEntry(TroggleModel):
# #return super(LogbookEntry, self).__init__(*args, **kwargs) # works in py3.5
# #return TroggleModel.__init__(*args, **kwargs) # fails in py3.5, runtime fail in 3.8
def cave(self): # Why didn't he just make this a foreign key to Cave ? Replaces __egtattrribute__ sillyness.
def cave(self): # Why didn't he just make this a foreign key to Cave ? Replaces __getattrribute__ sillyness.
c = CaveSlug.objects.get(slug=self.cave_slug, primary=True).cave
return c
@@ -540,13 +540,13 @@ class PersonTrip(TroggleModel):
def __str__(self):
return f'{self.personexpedition} ({self.logbook_entry.date})'
scansFileStorage = FileSystemStorage(location=settings.SURVEY_SCANS, base_url=settings.SURVEYS_URL)
def get_scan_path(instance, filename):
year=instance.survey.expedition.year
number=str(instance.survey.wallet_number)
if str(instance.survey.wallet_letter) != "None":
number=str(instance.survey.wallet_letter) + number #two strings formatting because convention is 2009#01 or 2009#X01
return os.path.join('./',year,year+r'#'+number,str(instance.contents)+str(instance.number_in_wallet)+r'.jpg')
# scansFileStorage = FileSystemStorage(location=settings.SURVEY_SCANS, base_url=settings.SURVEYS_URL)
# def get_scan_path(instance, filename):
# year=instance.survey.expedition.year
# number=str(instance.survey.wallet_number)
# if str(instance.survey.wallet_letter) != "None":
# number=str(instance.survey.wallet_letter) + number #two strings formatting because convention is 2009#01 or 2009#X01
# return os.path.join('./',year,year+r'#'+number,str(instance.contents)+str(instance.number_in_wallet)+r'.jpg')
Gcavelookup = None
Gcave_count = None