diff options
Diffstat (limited to 'core/models_caves.py')
-rw-r--r-- | core/models_caves.py | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/core/models_caves.py b/core/models_caves.py index 87138e2..eaad454 100644 --- a/core/models_caves.py +++ b/core/models_caves.py @@ -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) - - #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') - - def __str__(self): - return get_scan_path(self,'') +# 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') + + # #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,'') 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) |