diff options
Diffstat (limited to 'core/models.py')
-rw-r--r-- | core/models.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/models.py b/core/models.py index f87792e..32d4c68 100644 --- a/core/models.py +++ b/core/models.py @@ -800,9 +800,11 @@ class DPhoto(TroggleImageModel): scansFileStorage = FileSystemStorage(location=settings.SURVEY_SCANS, base_url=settings.SURVEYS_URL) def get_scan_path(instance, filename): year=instance.survey.expedition.year - #print "WN: ", type(instance.survey.wallet_number), instance.survey.wallet_number - number=str(instance.survey.wallet_number) + str(instance.survey.wallet_letter) #two strings formatting because convention is 2009#01 or 2009#X01 - return os.path.join('./',year,year+r'#'+number,instance.contents+str(instance.number_in_wallet)+r'.jpg') + #print("WN: ", type(instance.survey.wallet_number), instance.survey.wallet_number, instance.survey.wallet_letter) + 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') class ScannedImage(TroggleImageModel): file = models.ImageField(storage=scansFileStorage, upload_to=get_scan_path) |