forked from expo/troggle
simple rename survexscansfolder to scansfolder
This commit is contained in:
parent
b64c779a58
commit
9cd70b31ac
@ -376,7 +376,7 @@ class Migration(migrations.Migration):
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('ffile', models.CharField(max_length=200)),
|
||||
('name', models.CharField(max_length=200)),
|
||||
('survexscansfolder', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.ScansFolder')),
|
||||
('scansfolder', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.ScansFolder')),
|
||||
],
|
||||
options={
|
||||
'ordering': ('name',),
|
||||
@ -434,7 +434,7 @@ class Migration(migrations.Migration):
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='survexblock',
|
||||
name='survexscansfolder',
|
||||
name='scansfolder',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.ScansFolder'),
|
||||
),
|
||||
migrations.AddField(
|
||||
|
@ -123,7 +123,7 @@ class SurvexBlock(models.Model):
|
||||
# begin_char = models.IntegerField() # code for where in the survex data files this block sits
|
||||
survexpath = models.CharField(max_length=200) # the path for the survex stations
|
||||
|
||||
survexscansfolder = models.ForeignKey("ScansFolder", null=True,on_delete=models.CASCADE)
|
||||
scansfolder = models.ForeignKey("ScansFolder", null=True,on_delete=models.CASCADE)
|
||||
#refscandir = models.CharField(max_length=100)
|
||||
|
||||
legsall = models.IntegerField(null=True) # summary data for this block
|
||||
@ -211,16 +211,16 @@ class ScansFolder(models.Model):
|
||||
class SurvexScanSingle(models.Model):
|
||||
ffile = models.CharField(max_length=200)
|
||||
name = models.CharField(max_length=200)
|
||||
survexscansfolder = models.ForeignKey("ScansFolder", null=True,on_delete=models.CASCADE)
|
||||
scansfolder = models.ForeignKey("ScansFolder", null=True,on_delete=models.CASCADE)
|
||||
|
||||
class Meta:
|
||||
ordering = ('name',)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return urljoin(settings.URL_ROOT, reverse('surveyscansingle', kwargs={"path":re.sub("#", "%23", self.survexscansfolder.walletname), "file":self.name}))
|
||||
return urljoin(settings.URL_ROOT, reverse('surveyscansingle', kwargs={"path":re.sub("#", "%23", self.scansfolder.walletname), "file":self.name}))
|
||||
|
||||
def __str__(self):
|
||||
return "Survey Scan Image: " + str(self.name) + " in " + str(self.survexscansfolder)
|
||||
return "Survey Scan Image: " + str(self.name) + " in " + str(self.scansfolder)
|
||||
|
||||
class TunnelFile(models.Model):
|
||||
tunnelpath = models.CharField(max_length=200)
|
||||
|
@ -70,15 +70,15 @@ def SaveImageInDir(name, imgdir, project, fdata, bbinary):
|
||||
|
||||
def surveyscansfolder(request, path):
|
||||
#print [ s.walletname for s in ScansFolder.objects.all() ]
|
||||
survexscansfolder = ScansFolder.objects.get(walletname=urllib.parse.unquote(path))
|
||||
return render_to_response('survexscansfolder.html', { 'survexscansfolder':survexscansfolder, 'settings': settings })
|
||||
scansfolder = ScansFolder.objects.get(walletname=urllib.parse.unquote(path))
|
||||
return render_to_response('scansfolder.html', { 'scansfolder':scansfolder, 'settings': settings })
|
||||
|
||||
def surveyscansingle(request, path, file):
|
||||
survexscansfolder = ScansFolder.objects.get(walletname=urllib.parse.unquote(path))
|
||||
survexscansingle = SurvexScanSingle.objects.get(survexscansfolder=survexscansfolder, name=file)
|
||||
scansfolder = ScansFolder.objects.get(walletname=urllib.parse.unquote(path))
|
||||
survexscansingle = SurvexScanSingle.objects.get(scansfolder=scansfolder, name=file)
|
||||
print("SSS {} {} :{}:".format(path, file, flatviews.getmimetype(file)))
|
||||
return HttpResponse(content=open(survexscansingle.ffile,"rb"), content_type=flatviews.getmimetype(file))
|
||||
#return render_to_response('survexscansfolder.html', { 'survexscansfolder':survexscansfolder, 'settings': settings })
|
||||
#return render_to_response('scansfolder.html', { 'scansfolder':scansfolder, 'settings': settings })
|
||||
|
||||
def expofilessingle(request, filepath):
|
||||
# defaults to content_type="text/pain" needs fixing for PDFs
|
||||
|
@ -19,7 +19,7 @@ from troggle.core.views_caves import MapLocations
|
||||
|
||||
|
||||
"""A 'survex block' is a *begin...*end set of cave data.
|
||||
A 'survexscansfolder' is what we today call a "survey scans folder" or a "wallet".
|
||||
A 'scansfolder' is what we today call a "survey scans folder" or a "wallet".
|
||||
"""
|
||||
|
||||
rx_braskets= re.compile(r"[()]")
|
||||
@ -150,7 +150,7 @@ insp = ""
|
||||
callcount = 0
|
||||
def RecursiveLoad(survexblock, survexfile, fin):
|
||||
"""Follows the *include links in all the survex files from the root file 1623.svx
|
||||
and reads in the survex blocks, other data and the wallet references (survexscansfolder) as it
|
||||
and reads in the survex blocks, other data and the wallet references (scansfolder) as it
|
||||
goes. This part of the data import process is where the maximum memory is used and where it
|
||||
crashes on memory-constrained machines.
|
||||
"""
|
||||
@ -198,7 +198,7 @@ def RecursiveLoad(survexblock, survexfile, fin):
|
||||
refscan = "%s#%s%s" % (yr, letterx, wallet )
|
||||
manyscansfolders = models_survex.ScansFolder.objects.filter(walletname=refscan)
|
||||
if manyscansfolders:
|
||||
survexblock.survexscansfolder = manyscansfolders[0]
|
||||
survexblock.scansfolder = manyscansfolders[0]
|
||||
survexblock.save()
|
||||
else:
|
||||
message = ' ! Wallet ; ref {} - NOT found in manyscansfolders {}'.format(refscan, survexblock.survexfile.path)
|
||||
@ -264,7 +264,7 @@ def RecursiveLoad(survexblock, survexfile, fin):
|
||||
refscan = "%s#%s%s" % (yr, letterx, wallet)
|
||||
manyscansfolders = models_survex.ScansFolder.objects.filter(walletname=refscan)
|
||||
if manyscansfolders:
|
||||
survexblock.survexscansfolder = manyscansfolders[0]
|
||||
survexblock.scansfolder = manyscansfolders[0]
|
||||
survexblock.save()
|
||||
else:
|
||||
message = ' ! Wallet *REF {} - NOT found in manyscansfolders {}'.format(refscan, survexblock.survexfile.path)
|
||||
|
@ -52,10 +52,10 @@ def GetListDir(sdir):
|
||||
return res
|
||||
|
||||
|
||||
def LoadListScansFile(survexscansfolder):
|
||||
def LoadListScansFile(scansfolder):
|
||||
gld = [ ]
|
||||
# flatten out any directories in these wallet folders - should not be any
|
||||
for (fyf, ffyf, fisdiryf) in GetListDir(survexscansfolder.fpath):
|
||||
for (fyf, ffyf, fisdiryf) in GetListDir(scansfolder.fpath):
|
||||
if fisdiryf:
|
||||
gld.extend(GetListDir(ffyf))
|
||||
else:
|
||||
@ -65,7 +65,7 @@ def LoadListScansFile(survexscansfolder):
|
||||
for (fyf, ffyf, fisdiryf) in gld:
|
||||
#assert not fisdiryf, ffyf
|
||||
if re.search(r"\.(?:png|jpg|jpeg|pdf|svg|gif)(?i)$", fyf):
|
||||
survexscansingle = SurvexScanSingle(ffile=ffyf, name=fyf, survexscansfolder=survexscansfolder)
|
||||
survexscansingle = SurvexScanSingle(ffile=ffyf, name=fyf, scansfolder=scansfolder)
|
||||
survexscansingle.save()
|
||||
c+=1
|
||||
if c>=10:
|
||||
@ -103,15 +103,15 @@ def LoadListScans():
|
||||
for fy, ffy, fisdiry in GetListDir(ff):
|
||||
if fisdiry:
|
||||
assert fisdiry, ffy
|
||||
survexscansfolder = ScansFolder(fpath=ffy, walletname=fy)
|
||||
survexscansfolder.save()
|
||||
LoadListScansFile(survexscansfolder)
|
||||
scansfolder = ScansFolder(fpath=ffy, walletname=fy)
|
||||
scansfolder.save()
|
||||
LoadListScansFile(scansfolder)
|
||||
|
||||
# do the
|
||||
elif f != "thumbs":
|
||||
survexscansfolder = ScansFolder(fpath=ff, walletname=f)
|
||||
survexscansfolder.save()
|
||||
LoadListScansFile(survexscansfolder)
|
||||
scansfolder = ScansFolder(fpath=ff, walletname=f)
|
||||
scansfolder.save()
|
||||
LoadListScansFile(scansfolder)
|
||||
|
||||
|
||||
def FindTunnelScan(tunnelfile, path):
|
||||
|
@ -6,9 +6,9 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h3>Survey Scans in: {{survexscansfolder.walletname}}</h3>
|
||||
<h3>Survey Scans in: {{scansfolder.walletname}}</h3>
|
||||
<table>
|
||||
{% for survexscansingle in survexscansfolder.survexscansingle_set.all %}
|
||||
{% for survexscansingle in scansfolder.survexscansingle_set.all %}
|
||||
<tr>
|
||||
<td class="survexscansingle"><a href="{{survexscansingle.get_absolute_url}}">{{survexscansingle.name}}</a></td>
|
||||
<td>
|
||||
@ -23,7 +23,7 @@
|
||||
<h3>Survex surveys referring to this wallet</h3>
|
||||
|
||||
<table>
|
||||
{% for survexblock in survexscansfolder.survexblock_set.all %}
|
||||
{% for survexblock in scansfolder.survexblock_set.all %}
|
||||
<tr>
|
||||
<td><a href="{% url "svx" survexblock.survexfile.path %}">{{survexblock}}</a></td>
|
||||
</tr>
|
||||
|
@ -13,12 +13,12 @@ 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.
|
||||
<table>
|
||||
<tr><th>Scans folder</th><th>Files</th><th>Survex blocks</th></tr>
|
||||
{% for survexscansfolder in manyscansfolders %}
|
||||
{% for scansfolder in manyscansfolders %}
|
||||
<tr>
|
||||
<td><a href="{{survexscansfolder.get_absolute_url}}">{{survexscansfolder.walletname}}</a></td>
|
||||
<td>{{survexscansfolder.survexscansingle_set.all|length}}</td>
|
||||
<td><a href="{{scansfolder.get_absolute_url}}">{{scansfolder.walletname}}</a></td>
|
||||
<td>{{scansfolder.survexscansingle_set.all|length}}</td>
|
||||
<td>
|
||||
{% for survexblock in survexscansfolder.survexblock_set.all %}
|
||||
{% for survexblock in scansfolder.survexblock_set.all %}
|
||||
<a href="{% url "svx" survexblock.survexfile.path %}">{{survexblock}}</a>
|
||||
{% endfor %}
|
||||
</td>
|
||||
|
@ -66,8 +66,8 @@
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{% if survexblock.survexscansfolder %}
|
||||
<b><a href="{{survexblock.survexscansfolder.get_absolute_url}}">{{survexblock.survexscansfolder.walletname}}</a></b>
|
||||
{% if survexblock.scansfolder %}
|
||||
<b><a href="{{survexblock.scansfolder.get_absolute_url}}">{{survexblock.scansfolder.walletname}}</a></b>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -17,8 +17,8 @@
|
||||
<td>{{tunnelfile.npaths}}</td>
|
||||
|
||||
<td>
|
||||
{% for survexscansfolder in tunnelfile.manyscansfolders.all %}
|
||||
<a href="{{survexscansfolder.get_absolute_url}}">{{survexscansfolder.walletname}}</a>
|
||||
{% for scansfolder in tunnelfile.manyscansfolders.all %}
|
||||
<a href="{{scansfolder.get_absolute_url}}">{{scansfolder.walletname}}</a>
|
||||
{% endfor %}
|
||||
</td>
|
||||
|
||||
|
@ -390,7 +390,7 @@ class CoreSurvexblock(models.Model):
|
||||
expedition = models.ForeignKey(CoreExpedition, models.DO_NOTHING, blank=True, null=True)
|
||||
expeditionday = models.ForeignKey(CoreExpeditionday, models.DO_NOTHING, blank=True, null=True)
|
||||
survexfile = models.ForeignKey('CoreSurvexfile', models.DO_NOTHING, blank=True, null=True)
|
||||
survexscansfolder = models.ForeignKey('CoreSurvexscansfolder', models.DO_NOTHING, blank=True, null=True)
|
||||
scansfolder = models.ForeignKey('CoreSurvexscansfolder', models.DO_NOTHING, blank=True, null=True)
|
||||
parent = models.ForeignKey('self', models.DO_NOTHING, blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
@ -429,14 +429,14 @@ class CoreSurvexscansfolder(models.Model):
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
db_table = 'core_survexscansfolder'
|
||||
db_table = 'core_scansfolder'
|
||||
|
||||
|
||||
class CoreSurvexscansingle(models.Model):
|
||||
id = models.IntegerField(primary_key=True) # AutoField?
|
||||
ffile = models.CharField(max_length=200)
|
||||
name = models.CharField(max_length=200)
|
||||
survexscansfolder = models.ForeignKey(CoreSurvexscansfolder, models.DO_NOTHING, blank=True, null=True)
|
||||
scansfolder = models.ForeignKey(CoreSurvexscansfolder, models.DO_NOTHING, blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
@ -476,12 +476,12 @@ class CoreTunnelfileSurvexscans(models.Model):
|
||||
class CoreTunnelfileSurvexscansfolders(models.Model):
|
||||
id = models.IntegerField(primary_key=True) # AutoField?
|
||||
tunnelfile = models.ForeignKey(CoreTunnelfile, models.DO_NOTHING)
|
||||
survexscansfolder = models.ForeignKey(CoreSurvexscansfolder, models.DO_NOTHING)
|
||||
scansfolder = models.ForeignKey(CoreSurvexscansfolder, models.DO_NOTHING)
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
db_table = 'core_tunnelfile_survexscansfolders'
|
||||
unique_together = (('tunnelfile', 'survexscansfolder'),)
|
||||
db_table = 'core_tunnelfile_scansfolders'
|
||||
unique_together = (('tunnelfile', 'scansfolder'),)
|
||||
|
||||
|
||||
class CoreTunnelfileSurvextitles(models.Model):
|
||||
|
Loading…
Reference in New Issue
Block a user