Comment-out all ScannedImage objects

This commit is contained in:
Philip Sargent
2020-06-04 19:32:26 +01:00
parent ae89a707ec
commit c6d68749e0
3 changed files with 32 additions and 32 deletions

View File

@@ -538,26 +538,26 @@ def get_scan_path(instance, filename):
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)
scanned_by = models.ForeignKey(Person,blank=True, null=True)
scanned_on = models.DateField(null=True)
survey = models.ForeignKey('Survey')
contents = models.CharField(max_length=20,choices=(('notes','notes'),('plan','plan_sketch'),('elevation','elevation_sketch')))
number_in_wallet = models.IntegerField(null=True)
lon_utm = models.FloatField(blank=True,null=True)
lat_utm = models.FloatField(blank=True,null=True)
# class ScannedImage(TroggleImageModel):
# file = models.ImageField(storage=scansFileStorage, upload_to=get_scan_path)
# scanned_by = models.ForeignKey(Person,blank=True, null=True)
# scanned_on = models.DateField(null=True)
# survey = models.ForeignKey('Survey')
# contents = models.CharField(max_length=20,choices=(('notes','notes'),('plan','plan_sketch'),('elevation','elevation_sketch')))
# number_in_wallet = models.IntegerField(null=True)
# lon_utm = models.FloatField(blank=True,null=True)
# lat_utm = models.FloatField(blank=True,null=True)
#content_type = models.ForeignKey(ContentType)
#object_id = models.PositiveIntegerField()
#location = generic.GenericForeignKey('content_type', 'object_id')
# #content_type = models.ForeignKey(ContentType)
# #object_id = models.PositiveIntegerField()
# #location = generic.GenericForeignKey('content_type', 'object_id')
#This is an ugly hack to deal with the #s in our survey scan paths. The correct thing is to write a custom file storage backend which calls urlencode on the name for making file.url but not file.path.
def correctURL(self):
return string.replace(self.file.url,r'#',r'%23')
# #This is an ugly hack to deal with the #s in our survey scan paths. The correct thing is to write a custom file storage backend which calls urlencode on the name for making file.url but not file.path.
# def correctURL(self):
# return string.replace(self.file.url,r'#',r'%23')
def __str__(self):
return get_scan_path(self,'')
# def __str__(self):
# return get_scan_path(self,'')
class Survey(TroggleModel):
expedition = models.ForeignKey('Expedition') #REDUNDANT (logbook_entry)
@@ -580,14 +580,14 @@ class Survey(TroggleModel):
def __str__(self):
return self.expedition.year+"#"+"%02d" % int(self.wallet_number)
def notes(self):
return self.scannedimage_set.filter(contents='notes')
# def notes(self):
# return self.scannedimage_set.filter(contents='notes')
def plans(self):
return self.scannedimage_set.filter(contents='plan')
# def plans(self):
# return self.scannedimage_set.filter(contents='plan')
def elevations(self):
return self.scannedimage_set.filter(contents='elevation')
# def elevations(self):
# return self.scannedimage_set.filter(contents='elevation')
#
# Single Person going on a trip, which may or may not be written up (accounts for different T/U for people in same logbook entry)