From 9f5e779b5e4eee820c97a84c22b27a61aa73a91d Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Tue, 16 Jun 2020 16:17:35 +0100 Subject: [PATCH] remove Survey & virtual survey wallet - never used --- core/models.py | 12 --- core/models_caves.py | 54 +----------- parsers/imports.py | 8 -- templates/survey.html | 193 ------------------------------------------ urls.py | 4 - 5 files changed, 1 insertion(+), 270 deletions(-) delete mode 100644 templates/survey.html diff --git a/core/models.py b/core/models.py index 9414e58..c1aa8b3 100644 --- a/core/models.py +++ b/core/models.py @@ -58,18 +58,6 @@ class TroggleModel(models.Model): class Meta: abstract = True -class TroggleImageModel(models.Model): - new_since_parsing = models.BooleanField(default=False, editable=False) - - def object_name(self): - return self._meta.object_name - - def get_admin_url(self): - return urllib.parse.urljoin(settings.URL_ROOT, "/admin/core/" + self.object_name().lower() + "/" + str(self.pk)) - - class Meta: - abstract = True - class DataIssue(TroggleModel): date = models.DateTimeField(auto_now_add=True, blank=True) parser = models.CharField(max_length=50, blank=True, null=True) diff --git a/core/models_caves.py b/core/models_caves.py index 0027a29..2a80218 100644 --- a/core/models_caves.py +++ b/core/models_caves.py @@ -18,7 +18,7 @@ from django.conf import settings from django.core.urlresolvers import reverse from django.template import Context, loader -from troggle.core.models import TroggleModel, TroggleImageModel, Person, Expedition +from troggle.core.models import TroggleModel, Person, Expedition from troggle.core.models_survex import SurvexStation class Area(TroggleModel): @@ -537,58 +537,6 @@ def get_scan_path(instance, filename): if str(instance.survey.wallet_letter) != "None": 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 Survey(TroggleModel): - # expedition = models.ForeignKey('Expedition') #REDUNDANT (logbook_entry) - # wallet_number = models.IntegerField(blank=True,null=True) - # wallet_letter = models.CharField(max_length=1,blank=True,null=True) - # comments = models.TextField(blank=True,null=True) - # location = models.CharField(max_length=400,blank=True,null=True) #REDUNDANT - # subcave = models.ForeignKey('NewSubCave', blank=True, null=True) - # #notes_scan = models.ForeignKey('ScannedImage',related_name='notes_scan',blank=True, null=True) #Replaced by contents field of ScannedImage model - # survex_block = models.OneToOneField('SurvexBlock',blank=True, null=True) - # logbook_entry = models.ForeignKey('LogbookEntry') - # centreline_printed_on = models.DateField(blank=True, null=True) - # centreline_printed_by = models.ForeignKey('Person',related_name='centreline_printed_by',blank=True,null=True) - # #sketch_scan = models.ForeignKey(ScannedImage,blank=True, null=True) #Replaced by contents field of ScannedImage model - # tunnel_file = models.FileField(upload_to='surveyXMLfiles',blank=True, null=True) - # tunnel_main_sketch = models.ForeignKey('Survey',blank=True,null=True) - # integrated_into_main_sketch_on = models.DateField(blank=True,null=True) - # integrated_into_main_sketch_by = models.ForeignKey('Person' ,related_name='integrated_into_main_sketch_by', blank=True,null=True) - # rendered_image = models.ImageField(upload_to='renderedSurveys',blank=True,null=True) - # def __str__(self): - # return self.expedition.year+"#"+"%02d" % int(self.wallet_number) - - # def notes(self): - # return self.scannedimage_set.filter(contents='notes') - - # def plans(self): - # return self.scannedimage_set.filter(contents='plan') - - # 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) # diff --git a/parsers/imports.py b/parsers/imports.py index 65228f8..e5c7eb8 100644 --- a/parsers/imports.py +++ b/parsers/imports.py @@ -48,14 +48,6 @@ def import_survexpos(): print("Importing Survex x/y/z Positions") troggle.parsers.survex.LoadPos() -def import_surveyimgs(): - """This appears to store data in unused objects. The code is kept - for future re-working to manage progress against notes, plans and elevs. - """ - #import troggle.parsers.surveys - print("NOT Importing survey images") - #troggle.parsers.surveys.parseSurveys(logfile=settings.LOGFILE) - def import_tunnelfiles(): print("Importing Tunnel files") troggle.parsers.surveys.LoadTunnelFiles() diff --git a/templates/survey.html b/templates/survey.html deleted file mode 100644 index 13a8800..0000000 --- a/templates/survey.html +++ /dev/null @@ -1,193 +0,0 @@ -{% extends "base.html" %} -{% load wiki_markup %} - - -{% block title %}CUCC Virtual Survey Binder: {{ current_expedition }}{{ current_survey }}{%endblock%} -{% block head %} - - - - - -{% endblock %} - -
- CUCC Expo virtual survey binder: - {% if current_survey %} - {{current_survey}} - {% else %} - {{current_expedition}} - {% endif %} -
- -{% block nav %} -
- -

Choose a year

-
- -
- -
- - -
-{% if current_expedition %} -

Choose a wallet number

-
- - -
-

Click to toggle:

-
- - - - - - -
- -{% endif %} -{% endblock %} - - -{% block content %} -
- -
-

Survey progress table for {{ current_expedition }}

- {% if current_expedition.survey_set.all %} - - - - {% for survey in current_expedition.survey_set.all %} - - {% endfor %} - - - {% for survey in current_expedition.survey_set.all %} - - {% endfor %} - - - {% for survey in current_expedition.survey_set.all %} - - {% endfor %} - - - {% for survey in current_expedition.survey_set.all %} - - {% endfor %} - - - {% for survey in current_expedition.survey_set.all %} - - {% endfor %} -
{{ survey.wallet_number }}
Notes {% if survey.notes %} - ✓ - {% endif %}
Survex file {% if survey.survex_file %} - ✓ - {% endif %}
Plans {% if survey.plans %} - ✓ - {% endif %}
Elevations {% if survey.elevations %} - ✓ - {% endif %}
- {% else %} -
[ There are no surveys in the database for this year. Put link in to add one. ]
- {% endif %} -
-
-

Scanned notes for {{ current_survey }}.

- {% for noteItem in notes %} -
-

-

File at: {{ noteItem.file.name }}
- Scanned by: {{ noteItem.scanned_by }}
- On: {{ noteItem.scanned_on }}
-

-

-
- {% endfor %} - -
-
-
survex file editor, keeping file in original structure
- who entered by
-
centreline
-
-

Scanned plan sketch files for {{ current_survey }}.

- {% for sketchItem in planSketches %} -
-

-

File at: {{ sketchItem.file.name }}
- Scanned by: {{ sketchItem.scanned_by }}
- On: {{ sketchItem.scanned_on }}
-

-

-
- {% endfor %} - -
-
link to tunnel xml file. potentially instance of tunnel applet...
-
link to main sketch file
- -
-
- -{% endblock %} diff --git a/urls.py b/urls.py index be4e0aa..1f94552 100644 --- a/urls.py +++ b/urls.py @@ -78,10 +78,6 @@ actualurlpatterns = patterns('', url(r'^statistics/?$', views_statistics.stats, name="stats"), url(r'^pathsreport.*$', views_statistics.pathsreport, name="pathsreport"), -# url(r'^survey/?$', surveyindex, name="survey"), #url referred to troggle menu.. -# url(r'^survey/(?P\d\d\d\d)\#(?P\d*)$', survey, name="survey"), #Survey object - -# Is all this lot out of date ? Maybe the logbooks work? url(r'^controlpanel/?$', views_other.controlPanel, name="controlpanel"), url(r'^logbook(?P\d\d\d\d)\.(?P.*)/?$',views_other.downloadLogbook), url(r'^logbook/?$',views_other.downloadLogbook, name="downloadlogbook"),