From eb5406f325dfa1507c362bda19556c202c1de868 Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Thu, 20 Feb 2020 11:55:35 +0000 Subject: [PATCH 1/4] Add django migrations. These are needed on newer django installs to maintain the database --- core/migrations/0001_initial.py | 575 +++++++++++++++++++++++++++ core/migrations/__init__.py | 0 flatpages/migrations/0001_initial.py | 4 +- 3 files changed, 577 insertions(+), 2 deletions(-) create mode 100644 core/migrations/0001_initial.py create mode 100644 core/migrations/__init__.py diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py new file mode 100644 index 0000000..b9e0a34 --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,575 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.8 on 2020-02-18 16:01 +from __future__ import unicode_literals + +from django.conf import settings +import django.core.files.storage +from django.db import migrations, models +import django.db.models.deletion +import troggle.core.models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Area', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('non_public', models.BooleanField(default=False)), + ('short_name', models.CharField(max_length=100)), + ('name', models.CharField(blank=True, max_length=200, null=True)), + ('description', models.TextField(blank=True, null=True)), + ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Area')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='Cave', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('non_public', models.BooleanField(default=False)), + ('official_name', models.CharField(max_length=160)), + ('kataster_code', models.CharField(blank=True, max_length=20, null=True)), + ('kataster_number', models.CharField(blank=True, max_length=10, null=True)), + ('unofficial_number', models.CharField(blank=True, max_length=60, null=True)), + ('explorers', models.TextField(blank=True, null=True)), + ('underground_description', models.TextField(blank=True, null=True)), + ('equipment', models.TextField(blank=True, null=True)), + ('references', models.TextField(blank=True, null=True)), + ('survey', models.TextField(blank=True, null=True)), + ('kataster_status', models.TextField(blank=True, null=True)), + ('underground_centre_line', models.TextField(blank=True, null=True)), + ('notes', models.TextField(blank=True, null=True)), + ('length', models.CharField(blank=True, max_length=100, null=True)), + ('depth', models.CharField(blank=True, max_length=100, null=True)), + ('extent', models.CharField(blank=True, max_length=100, null=True)), + ('survex_file', models.CharField(blank=True, max_length=100, null=True)), + ('description_file', models.CharField(blank=True, max_length=200, null=True)), + ('url', models.CharField(blank=True, max_length=200, null=True)), + ('filename', models.CharField(max_length=200)), + ('area', models.ManyToManyField(blank=True, to='core.Area')), + ], + options={ + 'ordering': ('kataster_code', 'unofficial_number'), + }, + ), + migrations.CreateModel( + name='CaveAndEntrance', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('entrance_letter', models.CharField(blank=True, max_length=20, null=True)), + ('cave', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Cave')), + ], + ), + migrations.CreateModel( + name='CaveDescription', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('non_public', models.BooleanField(default=False)), + ('short_name', models.CharField(max_length=50, unique=True)), + ('long_name', models.CharField(blank=True, max_length=200, null=True)), + ('description', models.TextField(blank=True, null=True)), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='CaveSlug', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('slug', models.SlugField(unique=True)), + ('primary', models.BooleanField(default=False)), + ('cave', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Cave')), + ], + ), + migrations.CreateModel( + name='DataIssue', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('non_public', models.BooleanField(default=False)), + ('date', models.DateTimeField(auto_now_add=True)), + ('parser', models.CharField(blank=True, max_length=50, null=True)), + ('message', models.CharField(blank=True, max_length=400, null=True)), + ], + options={ + 'ordering': ['date'], + }, + ), + migrations.CreateModel( + name='DPhoto', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('caption', models.CharField(blank=True, max_length=1000, null=True)), + ('file', models.ImageField(storage=django.core.files.storage.FileSystemStorage(base_url=b'http://127.0.0.1:8000/photos/', location=b'/expo/expoweb/photos'), upload_to=b'.')), + ('is_mugshot', models.BooleanField(default=False)), + ('lon_utm', models.FloatField(blank=True, null=True)), + ('lat_utm', models.FloatField(blank=True, null=True)), + ('contains_cave', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Cave')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='Entrance', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('non_public', models.BooleanField(default=False)), + ('name', models.CharField(blank=True, max_length=100, null=True)), + ('entrance_description', models.TextField(blank=True, null=True)), + ('explorers', models.TextField(blank=True, null=True)), + ('map_description', models.TextField(blank=True, null=True)), + ('location_description', models.TextField(blank=True, null=True)), + ('approach', models.TextField(blank=True, null=True)), + ('underground_description', models.TextField(blank=True, null=True)), + ('photo', models.TextField(blank=True, null=True)), + ('marking', models.CharField(choices=[(b'P', b'Paint'), (b'P?', b'Paint (?)'), (b'T', b'Tag'), (b'T?', b'Tag (?)'), (b'R', b'Needs Retag'), (b'S', b'Spit'), (b'S?', b'Spit (?)'), (b'U', b'Unmarked'), (b'?', b'Unknown')], max_length=2)), + ('marking_comment', models.TextField(blank=True, null=True)), + ('findability', models.CharField(blank=True, choices=[(b'?', b'To be confirmed ...'), (b'S', b'Coordinates'), (b'L', b'Lost'), (b'R', b'Refindable')], max_length=1, null=True)), + ('findability_description', models.TextField(blank=True, null=True)), + ('alt', models.TextField(blank=True, null=True)), + ('northing', models.TextField(blank=True, null=True)), + ('easting', models.TextField(blank=True, null=True)), + ('tag_station', models.TextField(blank=True, null=True)), + ('exact_station', models.TextField(blank=True, null=True)), + ('other_station', models.TextField(blank=True, null=True)), + ('other_description', models.TextField(blank=True, null=True)), + ('bearings', models.TextField(blank=True, null=True)), + ('url', models.CharField(blank=True, max_length=200, null=True)), + ('filename', models.CharField(max_length=200)), + ('cached_primary_slug', models.CharField(blank=True, max_length=200, null=True)), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='EntranceSlug', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('slug', models.SlugField(unique=True)), + ('primary', models.BooleanField(default=False)), + ('entrance', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Entrance')), + ], + ), + migrations.CreateModel( + name='Expedition', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('non_public', models.BooleanField(default=False)), + ('year', models.CharField(max_length=20, unique=True)), + ('name', models.CharField(max_length=100)), + ], + options={ + 'ordering': ('-year',), + 'get_latest_by': 'year', + }, + ), + migrations.CreateModel( + name='ExpeditionDay', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('non_public', models.BooleanField(default=False)), + ('date', models.DateField()), + ('expedition', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Expedition')), + ], + options={ + 'ordering': ('date',), + }, + ), + migrations.CreateModel( + name='LogbookEntry', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('non_public', models.BooleanField(default=False)), + ('date', models.DateTimeField()), + ('title', models.CharField(max_length=200)), + ('cave_slug', models.SlugField()), + ('place', models.CharField(blank=True, help_text=b"Only use this if you haven't chosen a cave", max_length=100, null=True)), + ('text', models.TextField()), + ('slug', models.SlugField()), + ('filename', models.CharField(max_length=200, null=True)), + ('entry_type', models.CharField(choices=[(b'wiki', b'Wiki style logbook'), (b'html', b'Html style logbook')], default=b'wiki', max_length=50, null=True)), + ('expedition', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Expedition')), + ('expeditionday', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.ExpeditionDay')), + ], + options={ + 'ordering': ('-date',), + 'verbose_name_plural': 'Logbook Entries', + }, + ), + migrations.CreateModel( + name='NewSubCave', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('non_public', models.BooleanField(default=False)), + ('name', models.CharField(max_length=200, unique=True)), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='OtherCaveName', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('non_public', models.BooleanField(default=False)), + ('name', models.CharField(max_length=160)), + ('cave', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Cave')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='Person', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('non_public', models.BooleanField(default=False)), + ('first_name', models.CharField(max_length=100)), + ('last_name', models.CharField(max_length=100)), + ('fullname', models.CharField(max_length=200)), + ('is_vfho', models.BooleanField(default=False, help_text=b'VFHO is the Vereines für Höhlenkunde in Obersteier, a nearby Austrian caving club.')), + ('mug_shot', models.CharField(blank=True, max_length=100, null=True)), + ('blurb', models.TextField(blank=True, null=True)), + ('orderref', models.CharField(max_length=200)), + ('user', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + options={ + 'ordering': ('orderref',), + 'verbose_name_plural': 'People', + }, + ), + migrations.CreateModel( + name='PersonExpedition', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('non_public', models.BooleanField(default=False)), + ('slugfield', models.SlugField(blank=True, null=True)), + ('is_guest', models.BooleanField(default=False)), + ('expo_committee_position', models.CharField(blank=True, choices=[(b'leader', b'Expo leader'), (b'medical', b'Expo medical officer'), (b'treasurer', b'Expo treasurer'), (b'sponsorship', b'Expo sponsorship coordinator'), (b'research', b'Expo research coordinator')], max_length=200, null=True)), + ('nickname', models.CharField(blank=True, max_length=100, null=True)), + ('expedition', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Expedition')), + ('person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Person')), + ], + options={ + 'ordering': ('-expedition',), + }, + ), + migrations.CreateModel( + name='PersonTrip', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('non_public', models.BooleanField(default=False)), + ('time_underground', models.FloatField(help_text=b'In decimal hours')), + ('is_logbook_entry_author', models.BooleanField(default=False)), + ('logbook_entry', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.LogbookEntry')), + ('personexpedition', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.PersonExpedition')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='QM', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('non_public', models.BooleanField(default=False)), + ('number', models.IntegerField(help_text=b'this is the sequential number in the year')), + ('grade', models.CharField(choices=[(b'A', b'A: Large obvious lead'), (b'B', b'B: Average lead'), (b'C', b'C: Tight unpromising lead'), (b'D', b'D: Dig'), (b'X', b'X: Unclimbable aven')], max_length=1)), + ('location_description', models.TextField(blank=True)), + ('nearest_station_description', models.CharField(blank=True, max_length=400, null=True)), + ('nearest_station_name', models.CharField(blank=True, max_length=200, null=True)), + ('area', models.CharField(blank=True, max_length=100, null=True)), + ('completion_description', models.TextField(blank=True, null=True)), + ('comment', models.TextField(blank=True, null=True)), + ('found_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='QMs_found', to='core.LogbookEntry')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='ScannedImage', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('file', models.ImageField(storage=django.core.files.storage.FileSystemStorage(base_url=b'/survey_scans/', location=b'/expo/expofiles/'), upload_to=troggle.core.models.get_scan_path)), + ('scanned_on', models.DateField(null=True)), + ('contents', models.CharField(choices=[(b'notes', b'notes'), (b'plan', b'plan_sketch'), (b'elevation', b'elevation_sketch')], max_length=20)), + ('number_in_wallet', models.IntegerField(null=True)), + ('lon_utm', models.FloatField(blank=True, null=True)), + ('lat_utm', models.FloatField(blank=True, null=True)), + ('scanned_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Person')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='SurvexBlock', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=100)), + ('text', models.TextField()), + ('date', models.DateTimeField(blank=True, null=True)), + ('begin_char', models.IntegerField()), + ('survexpath', models.CharField(max_length=200)), + ('totalleglength', models.FloatField()), + ('cave', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Cave')), + ('expedition', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Expedition')), + ('expeditionday', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.ExpeditionDay')), + ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.SurvexBlock')), + ], + options={ + 'ordering': ('id',), + }, + ), + migrations.CreateModel( + name='SurvexDirectory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('path', models.CharField(max_length=200)), + ('cave', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Cave')), + ], + options={ + 'ordering': ('path',), + }, + ), + migrations.CreateModel( + name='SurvexEquate', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('cave', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Cave')), + ], + ), + migrations.CreateModel( + name='SurvexFile', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('path', models.CharField(max_length=200)), + ('cave', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Cave')), + ('survexdirectory', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.SurvexDirectory')), + ], + options={ + 'ordering': ('id',), + }, + ), + migrations.CreateModel( + name='SurvexLeg', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('tape', models.FloatField()), + ('compass', models.FloatField()), + ('clino', models.FloatField()), + ('block', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.SurvexBlock')), + ], + ), + migrations.CreateModel( + name='SurvexPersonRole', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nrole', models.CharField(blank=True, choices=[(b'insts', b'Instruments'), (b'dog', b'Other'), (b'notes', b'Notes'), (b'pics', b'Pictures'), (b'tape', b'Tape measure'), (b'useless', b'Useless'), (b'helper', b'Helper'), (b'disto', b'Disto'), (b'consultant', b'Consultant')], max_length=200, null=True)), + ('personname', models.CharField(max_length=100)), + ('expeditionday', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.ExpeditionDay')), + ('person', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Person')), + ('personexpedition', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.PersonExpedition')), + ('persontrip', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.PersonTrip')), + ('survexblock', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.SurvexBlock')), + ], + ), + migrations.CreateModel( + name='SurvexScansFolder', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('fpath', models.CharField(max_length=200)), + ('walletname', models.CharField(max_length=200)), + ], + options={ + 'ordering': ('walletname',), + }, + ), + migrations.CreateModel( + name='SurvexScanSingle', + fields=[ + ('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.SurvexScansFolder')), + ], + options={ + 'ordering': ('name',), + }, + ), + migrations.CreateModel( + name='SurvexStation', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=100)), + ('x', models.FloatField(blank=True, null=True)), + ('y', models.FloatField(blank=True, null=True)), + ('z', models.FloatField(blank=True, null=True)), + ('block', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.SurvexBlock')), + ('equate', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.SurvexEquate')), + ], + ), + migrations.CreateModel( + name='SurvexTitle', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=200)), + ('cave', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Cave')), + ('survexblock', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.SurvexBlock')), + ], + ), + migrations.CreateModel( + name='Survey', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('new_since_parsing', models.BooleanField(default=False, editable=False)), + ('non_public', models.BooleanField(default=False)), + ('wallet_number', models.IntegerField(blank=True, null=True)), + ('wallet_letter', models.CharField(blank=True, max_length=1, null=True)), + ('comments', models.TextField(blank=True, null=True)), + ('location', models.CharField(blank=True, max_length=400, null=True)), + ('centreline_printed_on', models.DateField(blank=True, null=True)), + ('tunnel_file', models.FileField(blank=True, null=True, upload_to=b'surveyXMLfiles')), + ('integrated_into_main_sketch_on', models.DateField(blank=True, null=True)), + ('rendered_image', models.ImageField(blank=True, null=True, upload_to=b'renderedSurveys')), + ('centreline_printed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='centreline_printed_by', to='core.Person')), + ('expedition', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Expedition')), + ('integrated_into_main_sketch_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='integrated_into_main_sketch_by', to='core.Person')), + ('logbook_entry', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.LogbookEntry')), + ('subcave', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.NewSubCave')), + ('survex_block', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.SurvexBlock')), + ('tunnel_main_sketch', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Survey')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='TunnelFile', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('tunnelpath', models.CharField(max_length=200)), + ('tunnelname', models.CharField(max_length=200)), + ('bfontcolours', models.BooleanField(default=False)), + ('filesize', models.IntegerField(default=0)), + ('npaths', models.IntegerField(default=0)), + ('survexblocks', models.ManyToManyField(to='core.SurvexBlock')), + ('survexscans', models.ManyToManyField(to='core.SurvexScanSingle')), + ('survexscansfolders', models.ManyToManyField(to='core.SurvexScansFolder')), + ('survextitles', models.ManyToManyField(to='core.SurvexTitle')), + ('tunnelcontains', models.ManyToManyField(to='core.TunnelFile')), + ], + options={ + 'ordering': ('tunnelpath',), + }, + ), + migrations.AddField( + model_name='survexleg', + name='stationfrom', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='stationfrom', to='core.SurvexStation'), + ), + migrations.AddField( + model_name='survexleg', + name='stationto', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='stationto', to='core.SurvexStation'), + ), + migrations.AddField( + model_name='survexdirectory', + name='primarysurvexfile', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='primarysurvexfile', to='core.SurvexFile'), + ), + migrations.AddField( + model_name='survexblock', + name='survexfile', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.SurvexFile'), + ), + migrations.AddField( + model_name='survexblock', + name='survexscansfolder', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.SurvexScansFolder'), + ), + migrations.AddField( + model_name='scannedimage', + name='survey', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Survey'), + ), + migrations.AddField( + model_name='qm', + name='nearest_station', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.SurvexStation'), + ), + migrations.AddField( + model_name='qm', + name='ticked_off_by', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='QMs_ticked_off', to='core.LogbookEntry'), + ), + migrations.AddField( + model_name='dphoto', + name='contains_entrance', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='photo_file', to='core.Entrance'), + ), + migrations.AddField( + model_name='dphoto', + name='contains_logbookentry', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.LogbookEntry'), + ), + migrations.AddField( + model_name='dphoto', + name='contains_person', + field=models.ManyToManyField(blank=True, to='core.Person'), + ), + migrations.AddField( + model_name='dphoto', + name='nearest_QM', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.QM'), + ), + migrations.AddField( + model_name='cavedescription', + name='linked_entrances', + field=models.ManyToManyField(blank=True, to='core.Entrance'), + ), + migrations.AddField( + model_name='cavedescription', + name='linked_qms', + field=models.ManyToManyField(blank=True, to='core.QM'), + ), + migrations.AddField( + model_name='cavedescription', + name='linked_subcaves', + field=models.ManyToManyField(blank=True, to='core.NewSubCave'), + ), + migrations.AddField( + model_name='caveandentrance', + name='entrance', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Entrance'), + ), + ] diff --git a/core/migrations/__init__.py b/core/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/flatpages/migrations/0001_initial.py b/flatpages/migrations/0001_initial.py index c292e88..07d2140 100644 --- a/flatpages/migrations/0001_initial.py +++ b/flatpages/migrations/0001_initial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.10.8 on 2019-07-14 19:45 +# Generated by Django 1.10.8 on 2020-02-18 16:01 from __future__ import unicode_literals from django.db import migrations, models @@ -11,7 +11,7 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('core', '0003_auto_20190714_2029'), + ('core', '0001_initial'), ] operations = [ From 291e3baabf09ccfd063c54db18f5db9018152a11 Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Fri, 21 Feb 2020 14:19:37 +0000 Subject: [PATCH 2/4] Get media working (at least in development) --- templates/base.html | 12 ++++++------ urls.py | 45 +++++++++++++++++++++++---------------------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/templates/base.html b/templates/base.html index e160b76..c5943d5 100644 --- a/templates/base.html +++ b/templates/base.html @@ -2,14 +2,14 @@ - - - + + + {% block title %}Troggle{% endblock %} - - - + + + {% block head %}{% endblock %} diff --git a/urls.py b/urls.py index 3ad52e5..263da81 100644 --- a/urls.py +++ b/urls.py @@ -1,6 +1,7 @@ from django.conf.urls import * from django.conf import settings from django.conf.urls.static import static +from django.views.static import serve from core.views import * # flat import from core.views_other import * @@ -12,7 +13,7 @@ from django.views.generic.edit import UpdateView from django.contrib import admin from django.views.generic.list import ListView from django.contrib import admin -admin.autodiscover() +#admin.autodiscover() # type url probably means it's used. @@ -22,23 +23,23 @@ admin.autodiscover() # ) actualurlpatterns = [ - + url(r'^testingurl/?$' , views_caves.millenialcaves, name="testing"), url(r'^millenialcaves/?$', views_caves.millenialcaves, name="millenialcaves"), - + url(r'^troggle$', views_other.frontpage, name="frontpage"), url(r'^todo/$', views_other.todo, name="todo"), - - url(r'^caves/?$', views_caves.caveindex, name="caveindex"), + + url(r'^caves/?$', views_caves.caveindex, name="caveindex"), url(r'^people/?$', views_logbooks.personindex, name="personindex"), url(r'^newqmnumber/?$', views_other.ajax_QM_number, ), - url(r'^lbo_suggestions/?$', logbook_entry_suggestions), + url(r'^lbo_suggestions/?$', logbook_entry_suggestions), #(r'^person/(?P\d*)/?$', views_logbooks.person), url(r'^person/(?P[A-Z]*[a-z\-\'&;]*)[^a-zA-Z]*(?P[a-z\-\']*[^a-zA-Z]*[A-Z]*[a-z\-&;]*)/?', views_logbooks.person, name="person"), #url(r'^person/(\w+_\w+)$', views_logbooks.person, name="person"), - + url(r'^expedition/(\d+)$', views_logbooks.expedition, name="expedition"), url(r'^expeditions/?$', views_logbooks.ExpeditionListView.as_view(), name="expeditions"), url(r'^personexpedition/(?P[A-Z]*[a-z&;]*)[^a-zA-Z]*(?P[A-Z]*[a-zA-Z&;]*)/(?P\d+)/?$', views_logbooks.personexpedition, name="personexpedition"), @@ -53,7 +54,7 @@ actualurlpatterns = [ url(r'^getPeople/(?P.*)', views_logbooks.get_people, name = "get_people"), url(r'^getLogBookEntries/(?P.*)', views_logbooks.get_logbook_entries, name = "get_logbook_entries"), - + url(r'^cave/new/$', views_caves.edit_cave, name="newcave"), url(r'^cave/(?P[^/]+)/?$', views_caves.cave, name="cave"), url(r'^caveslug/([^/]+)/?$', views_caves.caveSlug, name="caveSlug"), @@ -83,24 +84,24 @@ actualurlpatterns = [ url(r'^logbooksearch/(.*)/?$', views_logbooks.logbookSearch), url(r'^statistics/?$', views_other.stats, name="stats"), - + url(r'^survey/?$', surveyindex, name="survey"), url(r'^survey/(?P\d\d\d\d)\#(?P\d*)$', survey, name="survey"), url(r'^controlpanel/?$', views_other.controlPanel, name="controlpanel"), - url(r'^CAVETAB2\.CSV/?$', views_other.downloadCavetab, name="downloadcavetab"), + url(r'^CAVETAB2\.CSV/?$', views_other.downloadCavetab, name="downloadcavetab"), url(r'^Surveys\.csv/?$', views_other.downloadSurveys, name="downloadsurveys"), url(r'^logbook(?P\d\d\d\d)\.(?P.*)/?$',views_other.downloadLogbook), url(r'^logbook/?$',views_other.downloadLogbook, name="downloadlogbook"), - url(r'^cave/(?P[^/]+)/qm\.csv/?$', views_other.downloadQMs, name="downloadqms"), + url(r'^cave/(?P[^/]+)/qm\.csv/?$', views_other.downloadQMs, name="downloadqms"), url(r'^downloadqms$', views_other.downloadQMs), - + url(r'^eyecandy$', views_other.eyecandy), url(r'^admin/doc/?', include('django.contrib.admindocs.urls')), #url(r'^admin/(.*)', admin.site.get_urls, name="admin"), url(r'^admin/', include(admin.site.urls)), - + # don't know why this needs troggle/ in here. nice to get it out # url(r'^troggle/media-admin/(?P.*)$', static, {'document_root': settings.MEDIA_ADMIN_DIR, 'show_indexes':True}), @@ -111,7 +112,7 @@ actualurlpatterns = [ # (r'^personform/(.*)$', personForm), - url(r'^site_media/(?P.*)$', static, {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), + url(r'^site_media/(?P.*)$', serve, {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), url(r'^survexblock/(.+)$', views_caves.survexblock, name="survexblock"), url(r'^survexfile/(?P.*?)\.svx$', views_survex.svx, name="svx"), @@ -130,16 +131,16 @@ actualurlpatterns = [ #(r'^survey_files/upload/(?P.*)$', view_surveys.upload), #(r'^survey_scans/(?P.*)$', 'django.views.static.serve', {'document_root': settings.SURVEY_SCANS, 'show_indexes':True}), - url(r'^survey_scans/$', view_surveys.surveyscansfolders, name="surveyscansfolders"), - url(r'^survey_scans/(?P[^/]+)/$', view_surveys.surveyscansfolder, name="surveyscansfolder"), - url(r'^survey_scans/(?P[^/]+)/(?P[^/]+(?:png|jpg|jpeg))$', - view_surveys.surveyscansingle, name="surveyscansingle"), + url(r'^survey_scans/$', view_surveys.surveyscansfolders, name="surveyscansfolders"), + url(r'^survey_scans/(?P[^/]+)/$', view_surveys.surveyscansfolder, name="surveyscansfolder"), + url(r'^survey_scans/(?P[^/]+)/(?P[^/]+(?:png|jpg|jpeg))$', + view_surveys.surveyscansingle, name="surveyscansingle"), - url(r'^tunneldata/$', view_surveys.tunneldata, name="tunneldata"), - url(r'^tunneldataraw/(?P.+?\.xml)$', view_surveys.tunnelfile, name="tunnelfile"), - url(r'^tunneldataraw/(?P.+?\.xml)/upload$',view_surveys.tunnelfileupload, name="tunnelfileupload"), + url(r'^tunneldata/$', view_surveys.tunneldata, name="tunneldata"), + url(r'^tunneldataraw/(?P.+?\.xml)$', view_surveys.tunnelfile, name="tunnelfile"), + url(r'^tunneldataraw/(?P.+?\.xml)/upload$',view_surveys.tunnelfileupload, name="tunnelfileupload"), - #url(r'^tunneldatainfo/(?P.+?\.xml)$', view_surveys.tunnelfileinfo, name="tunnelfileinfo"), + #url(r'^tunneldatainfo/(?P.+?\.xml)$', view_surveys.tunnelfileinfo, name="tunnelfileinfo"), # url(r'^photos/(?P.*)$', 'django.views.static.serve', {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}), From 978270b152e803f0a8f1fac09363cc9703812567 Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Fri, 21 Feb 2020 14:25:13 +0000 Subject: [PATCH 3/4] Remove dud settings allow any site for dev --- localsettingsdocker.py | 11 +++-------- localsettingspotatohut.py | 9 ++------- localsettingsserver.py | 11 +++-------- localsettingsubuntu.py | 11 +++-------- localsettingswindows.py | 15 +++------------ 5 files changed, 14 insertions(+), 43 deletions(-) diff --git a/localsettingsdocker.py b/localsettingsdocker.py index bc7d8cb..6a325d1 100644 --- a/localsettingsdocker.py +++ b/localsettingsdocker.py @@ -2,7 +2,7 @@ import sys # This is the local settings for use with the docker compose dev setup. It is imported automatically DATABASES = { - 'default': { + 'default': { 'ENGINE': 'django.db.backends.mysql', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME' : 'troggle', # Or path to database file if using sqlite3. 'USER' : 'troggleuser', # Not used with sqlite3. @@ -12,6 +12,8 @@ DATABASES = { } } +ALLOWED_HOSTS = ['*'] + EXPOUSER = 'expo' EXPOUSERPASS = 'somepasshere' EXPOUSER_EMAIL = 'wookey@wookware.org' @@ -55,11 +57,4 @@ JSLIB_URL = URL_ROOT + 'javascript/' TINY_MCE_MEDIA_ROOT = STATIC_ROOT + '/tiny_mce/' TINY_MCE_MEDIA_URL = STATIC_ROOT + '/tiny_mce/' -TEMPLATE_DIRS = ( - PYTHON_PATH + "templates", - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. -) - LOGFILE = PYTHON_PATH + 'troggle_log.txt' diff --git a/localsettingspotatohut.py b/localsettingspotatohut.py index 976e61a..c6620a9 100644 --- a/localsettingspotatohut.py +++ b/localsettingspotatohut.py @@ -15,6 +15,8 @@ DATABASES = { } } +ALLOWED_HOSTS = ['*'] + REPOS_ROOT_PATH = '/home/expo/' sys.path.append(REPOS_ROOT_PATH) sys.path.append(REPOS_ROOT_PATH + 'troggle') @@ -53,13 +55,6 @@ JSLIB_PATH = '/usr/share/javascript/' TINY_MCE_MEDIA_ROOT = '/usr/share/tinymce/www/' TINY_MCE_MEDIA_URL = URL_ROOT + DIR_ROOT + 'tinymce_media/' -TEMPLATE_DIRS = ( - PYTHON_PATH + "templates", - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. -) - LOGFILE = '/home/expo/troggle/troggle_log.txt' FEINCMS_ADMIN_MEDIA='/site_media/feincms/' diff --git a/localsettingsserver.py b/localsettingsserver.py index 259974e..58bc1a9 100644 --- a/localsettingsserver.py +++ b/localsettingsserver.py @@ -1,6 +1,6 @@ import sys # This is an example file. Copy it to localsettings.py, set the -# password and _don't_ check that file back to the repo as it exposes +# password and _don't_ check that file back to the repo as it exposes # your/our password to the world! DATABASES = { @@ -14,6 +14,8 @@ DATABASES = { } } +ALLOWED_HOSTS = ['*'] + EXPOUSER = 'expo' EXPOUSERPASS = 'realpasshere' EXPOUSER_EMAIL = 'wookey@wookware.org' @@ -55,13 +57,6 @@ JSLIB_URL = URL_ROOT + 'javascript/' TINY_MCE_MEDIA_ROOT = STATIC_ROOT + '/tiny_mce/' TINY_MCE_MEDIA_URL = STATIC_ROOT + '/tiny_mce/' -TEMPLATE_DIRS = ( - PYTHON_PATH + "templates", - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. -) - LOGFILE = '/home/expo/troggle/troggle_log.txt' FEINCMS_ADMIN_MEDIA='/site_media/feincms/' diff --git a/localsettingsubuntu.py b/localsettingsubuntu.py index 3ae475d..26c1453 100644 --- a/localsettingsubuntu.py +++ b/localsettingsubuntu.py @@ -2,7 +2,7 @@ import sys # link localsettings to this file for use on expo computer in austria DATABASES = { - 'default': { + 'default': { 'ENGINE': 'django.db.backends.mysql', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME' : 'troggle', # Or path to database file if using sqlite3. 'USER' : 'expo', # Not used with sqlite3. @@ -12,6 +12,8 @@ DATABASES = { } } +ALLOWED_HOSTS = ['*'] + EXPOUSER = 'expo' EXPOUSERPASS = 'realpasshere' EXPOUSER_EMAIL = 'wookey@wookware.org' @@ -57,11 +59,4 @@ JSLIB_URL = URL_ROOT + 'javascript/' TINY_MCE_MEDIA_ROOT = '/usr/share/tinymce/www/' TINY_MCE_MEDIA_URL = URL_ROOT + DIR_ROOT + '/tinymce_media/' -TEMPLATE_DIRS = ( - PYTHON_PATH + "templates", - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. -) - LOGFILE = PYTHON_PATH + 'troggle_log.txt' diff --git a/localsettingswindows.py b/localsettingswindows.py index 110bd36..ed6f486 100644 --- a/localsettingswindows.py +++ b/localsettingswindows.py @@ -9,6 +9,8 @@ DATABASES = { } } +ALLOWED_HOSTS = ['*'] + EXPOUSER = 'expo' EXPOUSERPASS = 'realpasshere' EXPOUSER_EMAIL = 'wookey@wookware.org' @@ -30,7 +32,7 @@ URL_ROOT = 'http://127.0.0.1:8000' DIR_ROOT = ''#this should end in / if a value is given PUBLIC_SITE = False -TINY_MCE_MEDIA_ROOT = '/usr/share/tinymce/www/' +TINY_MCE_MEDIA_ROOT = '/usr/share/tinymce/www/' TINY_MCE_MEDIA_URL = URL_ROOT + DIR_ROOT + 'tinymce_media/' PYTHON_PATH = 'C:\\expoweb\\troggle\\' @@ -56,14 +58,3 @@ EMAIL_USE_TLS = True # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com", "http://example.com/media/" - - - - -TEMPLATE_DIRS = ( - "C:/Expo/expoweb/troggle/templates", - - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. -) From 92b273e45f96ac20fb182b9166b9f0a96f16eba3 Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Fri, 21 Feb 2020 14:26:14 +0000 Subject: [PATCH 4/4] Whitespace cleanup --- core/views_caves.py | 38 ++++++++++++++++++-------------------- docker/Dockerfile | 6 +++--- flatpages/views.py | 11 +++++------ parsers/logbooks.py | 2 +- templates/cave.html | 10 +++++----- 5 files changed, 32 insertions(+), 35 deletions(-) diff --git a/core/views_caves.py b/core/views_caves.py index 6dab34a..5ee0d82 100644 --- a/core/views_caves.py +++ b/core/views_caves.py @@ -29,7 +29,7 @@ def getCave(cave_id): return cave def pad5(x): - return "0" * (5 -len(x.group(0))) + x.group(0) + return "0" * (5 -len(x.group(0))) + x.group(0) def padnumber(x): return re.sub("\d+", pad5, x) def numericalcmp(x, y): @@ -46,7 +46,7 @@ def caveCmp(x, y): else: if y.kataster_number: return 1 - else: + else: return numericalcmp(x.unofficial_number, y.unofficial_number) def caveindex(request): @@ -62,7 +62,6 @@ def caveindex(request): def millenialcaves(request): #RW messing around area return HttpResponse("Test text", content_type="text/plain") - def cave3d(request, cave_id=''): @@ -154,14 +153,14 @@ def edit_cave(request, slug=None): ceinst.cave = cave ceinst.save() cave.writeDataFile() - return HttpResponseRedirect("/" + cave.url) + return HttpResponseRedirect("/" + cave.url) else: form = CaveForm(instance=cave) ceFormSet = CaveAndEntranceFormSet(queryset=cave.caveandentrance_set.all()) versionControlForm = VersionControlCommentForm() - - return render(request, - 'editcave2.html', + + return render(request, + 'editcave2.html', {'form': form, 'caveAndEntranceFormSet': ceFormSet, 'versionControlForm': versionControlForm @@ -169,7 +168,7 @@ def edit_cave(request, slug=None): @login_required_if_public def editEntrance(request, caveslug, slug=None): - cave = Cave.objects.get(caveslug__slug = caveslug) + cave = Cave.objects.get(caveslug__slug = caveslug) if slug is not None: entrance = Entrance.objects.get(entranceslug__slug = slug) else: @@ -196,7 +195,7 @@ def editEntrance(request, caveslug, slug=None): el.entrance = entrance el.save() entrance.writeDataFile() - return HttpResponseRedirect("/" + cave.url) + return HttpResponseRedirect("/" + cave.url) else: form = EntranceForm(instance = entrance) versionControlForm = VersionControlCommentForm() @@ -204,8 +203,8 @@ def editEntrance(request, caveslug, slug=None): entletter = EntranceLetterForm(request.POST) else: entletter = None - return render(request, - 'editentrance.html', + return render(request, + 'editentrance.html', {'form': form, 'versionControlForm': versionControlForm, 'entletter': entletter @@ -221,9 +220,8 @@ def qm(request,qm_id): if grade: url += r'&grade=' + grade return HttpResponseRedirect(url) - - + def ent(request, cave_id, ent_letter): cave = Cave.objects.filter(kataster_number = cave_id)[0] cave_and_ent = CaveAndEntrance.objects.filter(cave = cave).filter(entrance_letter = ent_letter)[0] @@ -255,7 +253,7 @@ def survey(request,year,wallet_number): surveys=Survey.objects.all() expeditions=Expedition.objects.order_by("-year") current_expedition=Expedition.objects.filter(year=year)[0] - + if wallet_number!='': current_survey=Survey.objects.filter(expedition=current_expedition,wallet_number=wallet_number)[0] notes=current_survey.scannedimage_set.filter(contents='notes') @@ -313,7 +311,7 @@ def prospecting(request): caves.sort(caveCmp) areas.append((name, a, caves)) return render(request, 'prospecting.html', {"areas": areas}) - + # Parameters for big map and zoomed subarea maps: # big map first (zoom factor ignored) @@ -343,7 +341,7 @@ for n in maps.keys(): for j in range(2): maps["%s%i%i" % (n, i, j)] = [L + i * W, T - j * H, L + (i + 1) * W, T - (j + 1) * H, S, name] # Keys in the order in which we want the maps output -mapcodes = ["all", "grieß","40", "76", "204", "tc"] +mapcodes = ["all", "grieß","40", "76", "204", "tc"] # Field codes L = 0 T = 1 @@ -400,7 +398,7 @@ def mungecoord(x, y, mapcode, img): COL_TYPES = {True: "red", False: "#dddddd", "Reference": "#dddddd"} - + def plot(surveypoint, number, point_type, label, mapcode, draw, img): try: ss = SurvexStation.objects.lookup(surveypoint) @@ -509,8 +507,8 @@ def prospecting_image(request, name): del draw img.save(response, "PNG") return response - -STATIONS = {} + +STATIONS = {} poslineregex = re.compile("^\(\s*([+-]?\d*\.\d*),\s*([+-]?\d*\.\d*),\s*([+-]?\d*\.\d*)\s*\)\s*([^\s]+)$") def LoadPos(): call([settings.CAVERN, "--output=%s/all.3d" % settings.SURVEX_DATA, "%s/all.svx" % settings.SURVEX_DATA]) @@ -518,7 +516,7 @@ def LoadPos(): posfile = open("%sall.pos" % settings.SURVEX_DATA) posfile.readline()#Drop header for line in posfile.readlines(): - r = poslineregex.match(line) + r = poslineregex.match(line) if r: x, y, z, name = r.groups() STATIONS[name] = (x, y, z) diff --git a/docker/Dockerfile b/docker/Dockerfile index 2b4882a..8dedd8d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -10,9 +10,9 @@ RUN apt-get -y update && apt-get install -y mercurial \ # Set the locale RUN locale-gen en_GB.UTF-8 -ENV LANG en_GB.UTF-8 -ENV LANGUAGE en_GB:en -ENV LC_ALL en_GB.UTF-8 +ENV LANG en_GB.UTF-8 +ENV LANGUAGE en_GB:en +ENV LC_ALL en_GB.UTF-8 WORKDIR /opt/expo/troggle COPY requirements.txt . diff --git a/flatpages/views.py b/flatpages/views.py index 6ef2404..0ba4d4e 100644 --- a/flatpages/views.py +++ b/flatpages/views.py @@ -33,7 +33,6 @@ def flatpage(request, path): except EntranceRedirect.DoesNotExist: pass - if path.startswith("noinfo") and settings.PUBLIC_SITE and not request.user.is_authenticated(): print("flat path noinfo", path) return HttpResponseRedirect(reverse("auth_login") + '?next=%s' % request.path) @@ -48,7 +47,7 @@ def flatpage(request, path): path = path + "index.htm" except IOError: return render(request, 'pagenotfound.html', {'path': path}) - else: + else: try: filetobeopened = os.path.normpath(settings.EXPOWEB + path) o = open(filetobeopened, "rb") @@ -56,7 +55,7 @@ def flatpage(request, path): return render(request, 'pagenotfound.html', {'path': path}) if path.endswith(".htm") or path.endswith(".html"): html = o.read() - + m = re.search(r"(.*)<\s*head([^>]*)>(.*)<\s*/head\s*>(.*)<\s*body([^>]*)>(.*)<\s*/body\s*>(.*)", html, re.DOTALL + re.IGNORECASE) if m: preheader, headerattrs, head, postheader, bodyattrs, body, postbody = m.groups() @@ -125,7 +124,7 @@ def editflatpage(request, path): return HttpResponse("Page could not be split into header and body") except IOError: filefound = False - + if request.method == 'POST': # If the form has been submitted... flatpageForm = FlatPageForm(request.POST) # A form bound to the POST data @@ -142,7 +141,7 @@ def editflatpage(request, path): headerargs = "" postheader = "" bodyargs = "" - postbody = "" + postbody = "" body = flatpageForm.cleaned_data["html"] body = body.replace("\r", "") result = u"%s%s%s\n%s%s" % (preheader, headerargs, head, postheader, bodyargs, body, postbody) @@ -153,7 +152,7 @@ def editflatpage(request, path): else: if filefound: m = re.search(r"(.*)", head, re.DOTALL + re.IGNORECASE) - if m: + if m: title, = m.groups() else: title = "" diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 012d771..2f92c8e 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -166,7 +166,7 @@ def Parseloghtmltxt(year, expedition, txt): for trippara in tripparas: #print(" - HR detected - maybe a trip?") logbook_entry_count += 1 - + s = re.match(r'''(?x)(?:\s*.*?\s*

)? # second date \s*(?:\s*)? \s*(.*?)(?:

)? diff --git a/templates/cave.html b/templates/cave.html index 1ba898e..7d21ca7 100644 --- a/templates/cave.html +++ b/templates/cave.html @@ -17,7 +17,7 @@ div.cv-panel { } div.cv-compass, div.cv-ahi { - position: absolute; + position: absolute; bottom: 95px; right: 5px; margin: 0; @@ -31,7 +31,7 @@ div.cv-compass, div.cv-ahi { background-color: black; color: white; } - + div.cv-ahi { right: 95px; } @@ -152,7 +152,7 @@ div.linear-scale-caption { position: absolute; top: 64px; left: 0px; - height: auto; + height: auto; margin-top:0; bottom: 44px; background-color: #222222; @@ -220,7 +220,7 @@ div.linear-scale-caption { } #frame .tab { position: absolute; - right: 0px;lass="cavedisplay" + right: 0px; width: 40px; height: 40px; box-sizing: border-box; @@ -523,7 +523,7 @@ div#scene { {% endif %} {{ ent.entrance.other_location.y|safe }}, {{ ent.entrance.other_location.x|safe }}, {{ ent.entrance.other_location.z|safe }}m {% endif %} - + {% endfor %}