2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

reanme manyscansfolders to manywallets

This commit is contained in:
Philip Sargent 2021-04-26 19:22:29 +01:00
parent 7dd5840353
commit 7f64670f36
6 changed files with 23 additions and 23 deletions

View File

@ -186,8 +186,8 @@ class Wallet(models.Model):
return str(self.walletname) + " (Survey Scans Folder)" return str(self.walletname) + " (Survey Scans Folder)"
class SingleScan(models.Model): class SingleScan(models.Model):
ffile = models.CharField(max_length=200) ffile = models.CharField(max_length=200)
name = models.CharField(max_length=200) name = models.CharField(max_length=200)
scansfolder = models.ForeignKey("Wallet", null=True,on_delete=models.SET_NULL) scansfolder = models.ForeignKey("Wallet", null=True,on_delete=models.SET_NULL)
class Meta: class Meta:
@ -202,13 +202,13 @@ class SingleScan(models.Model):
class DrawingFile(models.Model): class DrawingFile(models.Model):
dwgpath = models.CharField(max_length=200) dwgpath = models.CharField(max_length=200)
dwgname = models.CharField(max_length=200) dwgname = models.CharField(max_length=200)
bfontcolours = models.BooleanField(default=False) # UNUSED now, can be deleted bfontcolours = models.BooleanField(default=False) # UNUSED now, can be deleted
manyscansfolders = models.ManyToManyField("Wallet") # implicitly links via folders to scans to SVX files manywallets = models.ManyToManyField("Wallet") # implicitly links via folders to scans to SVX files
scans = models.ManyToManyField("SingleScan") # implicitly links via scans to SVX files scans = models.ManyToManyField("SingleScan") # implicitly links via scans to SVX files
dwgcontains = models.ManyToManyField("DrawingFile") # case when its a frame type dwgcontains = models.ManyToManyField("DrawingFile") # case when its a frame type
filesize = models.IntegerField(default=0) filesize = models.IntegerField(default=0)
npaths = models.IntegerField(default=0) npaths = models.IntegerField(default=0)
survexfiles = models.ManyToManyField("SurvexFile") # direct link to SVX files - not populated yet survexfiles = models.ManyToManyField("SurvexFile") # direct link to SVX files - not populated yet
class Meta: class Meta:
ordering = ('dwgpath',) ordering = ('dwgpath',)

View File

@ -43,8 +43,8 @@ def scansingle(request, path, file):
def scanswallets(request): def scanswallets(request):
manyscansfolders = Wallet.objects.all() manywallets = Wallet.objects.all()
return render(request, 'manyscansfolders.html', { 'manyscansfolders':manyscansfolders, 'settings': settings }) return render(request, 'manywallets.html', { 'manywallets':manywallets, 'settings': settings })
def dwgdata(request): def dwgdata(request):

View File

@ -473,13 +473,13 @@ class LoadingSurvex():
message = " ! Wallet *REF {} - not numeric in '{}'".format(refscan, survexblock.survexfile.path) message = " ! Wallet *REF {} - not numeric in '{}'".format(refscan, survexblock.survexfile.path)
print((self.insp+message)) print((self.insp+message))
DataIssue.objects.create(parser='survex', message=message) DataIssue.objects.create(parser='survex', message=message)
manyscansfolders = Wallet.objects.filter(walletname=refscan) manywallets = Wallet.objects.filter(walletname=refscan)
if manyscansfolders: if manywallets:
survexblock.scansfolder = manyscansfolders[0] # this is a ForeignKey field survexblock.scansfolder = manywallets[0] # this is a ForeignKey field
print(manyscansfolders[0]) print(manywallets[0])
survexblock.save() survexblock.save()
if len(manyscansfolders) > 1: if len(manywallets) > 1:
message = " ! Wallet *REF {} - {} scan folders from DB search in {}".format(refscan, len(manyscansfolders), survexblock.survexfile.path) message = " ! Wallet *REF {} - {} scan folders from DB search in {}".format(refscan, len(manywallets), survexblock.survexfile.path)
print((self.insp+message)) print((self.insp+message))
DataIssue.objects.create(parser='survex', message=message) DataIssue.objects.create(parser='survex', message=message)
else: else:

View File

@ -89,11 +89,11 @@ def LoadListScans():
print(' - deleting all scansFolder and scansSingle objects') print(' - deleting all scansFolder and scansSingle objects')
# first do the smkhs (large kh survey scans) directory # first do the smkhs (large kh survey scans) directory
manyscansfoldersmkhs = Wallet(fpath=os.path.join(settings.SURVEY_SCANS, "../surveys/smkhs"), walletname="smkhs") manywallets_smkhs = Wallet(fpath=os.path.join(settings.SURVEY_SCANS, "../surveys/smkhs"), walletname="smkhs")
print("smkhs", end=' ') print("smkhs", end=' ')
if os.path.isdir(manyscansfoldersmkhs.fpath): if os.path.isdir(manywallets_smkhs.fpath):
manyscansfoldersmkhs.save() manywallets_smkhs.save()
LoadListScansFile(manyscansfoldersmkhs) LoadListScansFile(manywallets_smkhs)
# iterate into the surveyscans directory # iterate into the surveyscans directory
@ -144,7 +144,7 @@ def find_tunnel_scan(dwgfile, path):
scansfile = scansfilel[0] scansfile = scansfilel[0]
if scansfolder: if scansfolder:
dwgfile.manyscansfolders.add(scansfolder) dwgfile.manywallets.add(scansfolder)
if scansfile: if scansfile:
dwgfile.scans.add(scansfile) dwgfile.scans.add(scansfile)

View File

@ -17,7 +17,7 @@
<td align="right" style="padding:2px">{{dwgfile.npaths}}</td> <td align="right" style="padding:2px">{{dwgfile.npaths}}</td>
<td style="padding:2px"> <td style="padding:2px">
{% for scansfolder in dwgfile.manyscansfolders.all %} {% for scansfolder in dwgfile.manywallets.all %}
<a href="{{scansfolder.get_absolute_url}}">{{scansfolder.walletname}}</a> <a href="{{scansfolder.get_absolute_url}}">{{scansfolder.walletname}}</a>
{% endfor %} {% endfor %}
</td> </td>

View File

@ -13,7 +13,7 @@ hand-drawn passage sections are drawn. These hand-drawn passages will eventually
traced to produce Tunnel or Therion drawings and eventually the final complete cave survey. traced to produce Tunnel or Therion drawings and eventually the final complete cave survey.
<table width=95%> <table width=95%>
<tr><th>Scans folder</th><th>Files</th><th>Survex blocks</th></tr> <tr><th>Scans folder</th><th>Files</th><th>Survex blocks</th></tr>
{% for scansfolder in manyscansfolders %} {% for scansfolder in manywallets %}
<tr> <tr>
<td style="padding:2px"><a href="{{scansfolder.get_absolute_url}}">{{scansfolder.walletname}}</a></td> <td style="padding:2px"><a href="{{scansfolder.get_absolute_url}}">{{scansfolder.walletname}}</a></td>
<td align="right" style="padding:2px">{{scansfolder.singlescan_set.all|length}}</td> <td align="right" style="padding:2px">{{scansfolder.singlescan_set.all|length}}</td>