mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 08:41:51 +00:00
Comment-out all ScannedImage objects
This commit is contained in:
parent
ae89a707ec
commit
c6d68749e0
@ -6,7 +6,7 @@ from django.core import serializers
|
||||
|
||||
from troggle.core.views_other import downloadLogbook
|
||||
from troggle.core.models import *
|
||||
from troggle.core.models_caves import Cave, Area, Entrance, CaveAndEntrance, NewSubCave, OtherCaveName, CaveDescription, LogbookEntry, PersonTrip, Survey, ScannedImage, QM
|
||||
from troggle.core.models_caves import Cave, Area, Entrance, CaveAndEntrance, NewSubCave, OtherCaveName, CaveDescription, LogbookEntry, PersonTrip, Survey, QM
|
||||
from troggle.core.models_survex import SurvexBlock, SurvexPersonRole, SurvexStation, SurvexScansFolder, SurvexScanSingle
|
||||
#from troggle.reversion.admin import VersionAdmin #django-reversion version control
|
||||
|
||||
@ -31,9 +31,9 @@ class SurvexBlockAdmin(TroggleModelAdmin):
|
||||
inlines = (RoleInline,)
|
||||
|
||||
|
||||
class ScannedImageInline(admin.TabularInline):
|
||||
model = ScannedImage
|
||||
extra = 4
|
||||
# class ScannedImageInline(admin.TabularInline):
|
||||
# model = ScannedImage
|
||||
# extra = 4
|
||||
|
||||
|
||||
class OtherCaveInline(admin.TabularInline):
|
||||
@ -42,7 +42,7 @@ class OtherCaveInline(admin.TabularInline):
|
||||
|
||||
|
||||
class SurveyAdmin(TroggleModelAdmin):
|
||||
inlines = (ScannedImageInline,)
|
||||
#inlines = (ScannedImageInline,)
|
||||
search_fields = ('expedition__year','wallet_number')
|
||||
|
||||
|
||||
@ -137,7 +137,7 @@ admin.site.register(LogbookEntry, LogbookEntryAdmin)
|
||||
#admin.site.register(PersonTrip)
|
||||
admin.site.register(QM, QMAdmin)
|
||||
admin.site.register(Survey, SurveyAdmin)
|
||||
admin.site.register(ScannedImage)
|
||||
#admin.site.register(ScannedImage)
|
||||
admin.site.register(SurvexStation)
|
||||
|
||||
admin.site.register(SurvexScansFolder)
|
||||
|
@ -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)
|
||||
|
@ -278,9 +278,9 @@ def survey(request,year,wallet_number):
|
||||
|
||||
if wallet_number!='':
|
||||
current_survey=Survey.objects.filter(expedition=current_expedition,wallet_number=wallet_number)[0]
|
||||
notes=current_survey.scannedimage_set.filter(contents='notes')
|
||||
planSketches=current_survey.scannedimage_set.filter(contents='plan')
|
||||
elevationSketches=current_survey.scannedimage_set.filter(contents='elevation')
|
||||
# notes=current_survey.scannedimage_set.filter(contents='notes')
|
||||
# planSketches=current_survey.scannedimage_set.filter(contents='plan')
|
||||
# elevationSketches=current_survey.scannedimage_set.filter(contents='elevation')
|
||||
|
||||
return render(request,'survey.html', locals())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user