mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-12-18 06:22:18 +00:00
import order fixed by ruff
This commit is contained in:
parent
eb74940ca8
commit
30760654b7
@ -5,13 +5,12 @@ Modified for Expo April 2021.
|
|||||||
import re
|
import re
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
from django.test import Client, TestCase
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
from django.test import Client, TestCase
|
||||||
|
|
||||||
import settings
|
import settings
|
||||||
|
|
||||||
from troggle.core.models.caves import Cave
|
from troggle.core.models.caves import Cave
|
||||||
from troggle.core.models.troggle import Person, PersonExpedition, Expedition
|
from troggle.core.models.troggle import Expedition, Person, PersonExpedition
|
||||||
from troggle.core.utils import current_expo
|
from troggle.core.utils import current_expo
|
||||||
|
|
||||||
current_year = current_expo()
|
current_year = current_expo()
|
||||||
|
@ -83,7 +83,7 @@ class SimpleTest(SimpleTestCase):
|
|||||||
|
|
||||||
import troggle.core.views.expo
|
import troggle.core.views.expo
|
||||||
from troggle.core.forms import CaveForm, EntranceForm, EntranceLetterForm
|
from troggle.core.forms import CaveForm, EntranceForm, EntranceLetterForm
|
||||||
from troggle.core.models.caves import Cave, CaveAndEntrance, Entrance, SurvexStation #EntranceSlug,
|
from troggle.core.models.caves import Cave, CaveAndEntrance, Entrance, SurvexStation #EntranceSlug,
|
||||||
from troggle.core.models.troggle import Expedition
|
from troggle.core.models.troggle import Expedition
|
||||||
from troggle.core.views.auth import login_required_if_public
|
from troggle.core.views.auth import login_required_if_public
|
||||||
|
|
||||||
@ -107,6 +107,7 @@ class SimpleTest(SimpleTestCase):
|
|||||||
|
|
||||||
def test_import_urls(self):
|
def test_import_urls(self):
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
#from django.conf.urls import include, url
|
#from django.conf.urls import include, url
|
||||||
from django.contrib import admin, auth
|
from django.contrib import admin, auth
|
||||||
from django.urls import resolve, reverse
|
from django.urls import resolve, reverse
|
||||||
@ -146,7 +147,7 @@ class ImportTest(TestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
import troggle.settings as settings
|
import troggle.settings as settings
|
||||||
from troggle.parsers.logbooks import LOGBOOKS_DIR, DEFAULT_LOGBOOK_FILE
|
from troggle.parsers.logbooks import DEFAULT_LOGBOOK_FILE, LOGBOOKS_DIR
|
||||||
|
|
||||||
LOGBOOKS_PATH = settings.EXPOWEB / LOGBOOKS_DIR
|
LOGBOOKS_PATH = settings.EXPOWEB / LOGBOOKS_DIR
|
||||||
test_year = "1986"
|
test_year = "1986"
|
||||||
|
@ -9,12 +9,12 @@ import pathlib
|
|||||||
import re
|
import re
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
|
from django.contrib.auth.models import User
|
||||||
from django.test import Client, TestCase
|
from django.test import Client, TestCase
|
||||||
|
|
||||||
import troggle.settings as settings
|
import troggle.settings as settings
|
||||||
from troggle.core.models.wallets import Wallet
|
|
||||||
from troggle.core.models.troggle import Expedition
|
from troggle.core.models.troggle import Expedition
|
||||||
from django.contrib.auth.models import User
|
from troggle.core.models.wallets import Wallet
|
||||||
from troggle.core.utils import current_expo
|
from troggle.core.utils import current_expo
|
||||||
|
|
||||||
current_year = current_expo()
|
current_year = current_expo()
|
||||||
|
@ -22,13 +22,13 @@ import subprocess
|
|||||||
import unittest
|
import unittest
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
from django.test import Client, SimpleTestCase, TestCase
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
from django.test import Client, SimpleTestCase, TestCase
|
||||||
|
|
||||||
from troggle.core.models.logbooks import LogbookEntry
|
|
||||||
from troggle.core.models.troggle import Expedition, DataIssue, Person, PersonExpedition
|
|
||||||
from troggle.core.utils import current_expo
|
|
||||||
import troggle.parsers.logbooks as lbp
|
import troggle.parsers.logbooks as lbp
|
||||||
|
from troggle.core.models.logbooks import LogbookEntry
|
||||||
|
from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition
|
||||||
|
from troggle.core.utils import current_expo
|
||||||
|
|
||||||
current_year = current_expo()
|
current_year = current_expo()
|
||||||
|
|
||||||
|
@ -91,7 +91,8 @@ import re
|
|||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
from django.test import Client, TestCase
|
from django.test import Client, TestCase
|
||||||
from django.urls import reverse, path
|
from django.urls import path, reverse
|
||||||
|
|
||||||
|
|
||||||
# class SimplePageTest(unittest.TestCase):
|
# class SimplePageTest(unittest.TestCase):
|
||||||
class URLTests(TestCase):
|
class URLTests(TestCase):
|
||||||
|
@ -29,8 +29,7 @@ class ImportTest(TestCase):
|
|||||||
#ed to go through all modules and copy all imports here
|
#ed to go through all modules and copy all imports here
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
from cuy.club.models import (Article, Event, Member, Webpage,
|
from cuy.club.models import Article, Event, Member, Webpage, WebpageCategory
|
||||||
WebpageCategory)
|
|
||||||
from cuy.website.views.generic import PUBLIC_LOGIN
|
from cuy.website.views.generic import PUBLIC_LOGIN
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Copilot: Sure, based on your `urls.py` file, here's how you might write end-to-end tests for the `survey_scans` endpoints:
|
# Copilot: Sure, based on your `urls.py` file, here's how you might write end-to-end tests for the `survey_scans` endpoints:
|
||||||
|
|
||||||
from django.test import TestCase, Client
|
from django.test import Client, TestCase
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
# Copilot does not know that there is no data in the database, so that the tests need to pre-populate with
|
# Copilot does not know that there is no data in the database, so that the tests need to pre-populate with
|
||||||
|
@ -12,8 +12,8 @@ from troggle.core.models.survex import (
|
|||||||
SurvexPersonRole,
|
SurvexPersonRole,
|
||||||
SurvexStation,
|
SurvexStation,
|
||||||
)
|
)
|
||||||
from troggle.core.models.wallets import Wallet
|
|
||||||
from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition
|
from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition
|
||||||
|
from troggle.core.models.wallets import Wallet
|
||||||
|
|
||||||
"""This code significantly adds to the capabilities of the Django Management control panel for Troggle data.
|
"""This code significantly adds to the capabilities of the Django Management control panel for Troggle data.
|
||||||
In particular, it enables JSON export of any data with 'export_as_json'
|
In particular, it enables JSON export of any data with 'export_as_json'
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
|
|
||||||
|
# from tinymce.widgets import TinyMCE
|
||||||
|
import re
|
||||||
|
|
||||||
import django.forms as forms
|
import django.forms as forms
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
from django.forms import ModelForm
|
from django.forms import ModelForm
|
||||||
from django.forms.models import modelformset_factory
|
from django.forms.models import modelformset_factory
|
||||||
|
|
||||||
from troggle.core.models.caves import Cave, CaveAndEntrance, Entrance
|
from troggle.core.models.caves import Cave, CaveAndEntrance, Entrance
|
||||||
from troggle.core.views.editor_helpers import HTMLarea
|
from troggle.core.views.editor_helpers import HTMLarea
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
|
||||||
|
|
||||||
# from tinymce.widgets import TinyMCE
|
|
||||||
import re
|
|
||||||
|
|
||||||
|
|
||||||
"""These are all the class-based Forms used by troggle.
|
"""These are all the class-based Forms used by troggle.
|
||||||
There are other, simpler, upload forms in view/uploads.py
|
There are other, simpler, upload forms in view/uploads.py
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
|
|
||||||
"""this is now replaced by databaseRest.py
|
"""this is now replaced by databaseRest.py
|
||||||
|
|
||||||
This is an example of how to create our own bespoke commandline
|
This is an example of how to create our own bespoke commandline
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
import os
|
import os
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from django.db import models, DataError
|
from django.db import DataError, models
|
||||||
from django.template import loader
|
from django.template import loader
|
||||||
|
|
||||||
import settings
|
import settings
|
||||||
from troggle.core.models.logbooks import QM
|
from troggle.core.models.logbooks import QM
|
||||||
from troggle.core.models.survex import SurvexStation, utmToLatLng
|
from troggle.core.models.survex import SurvexStation, utmToLatLng
|
||||||
from troggle.core.models.troggle import DataIssue, TroggleModel
|
from troggle.core.models.troggle import DataIssue, TroggleModel
|
||||||
from troggle.core.utils import TROG, writetrogglefile, parse_aliases
|
from troggle.core.utils import TROG, parse_aliases, writetrogglefile
|
||||||
|
|
||||||
# Use the TROG global object to cache the cave lookup list. No good for multi-user.., or even multi-page. Pointless in fact.
|
# Use the TROG global object to cache the cave lookup list. No good for multi-user.., or even multi-page. Pointless in fact.
|
||||||
Gcavelookup = TROG["caves"]["gcavelookup"]
|
Gcavelookup = TROG["caves"]["gcavelookup"]
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.urls import reverse
|
|
||||||
from django.template import loader
|
from django.template import loader
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
import settings
|
import settings
|
||||||
from troggle.core.models.troggle import Expedition, TroggleModel
|
from troggle.core.models.troggle import Expedition, TroggleModel
|
||||||
|
|
||||||
|
|
||||||
"""The model declarations LogBookEntry, PersonLogEntry, QM
|
"""The model declarations LogBookEntry, PersonLogEntry, QM
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from urllib.parse import urljoin
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
from troggle.core.utils import height_from_utm, throw
|
from troggle.core.utils import height_from_utm, throw
|
||||||
|
|
||||||
# from troggle.core.models.troggle import DataIssue # circular import. Hmm
|
# from troggle.core.models.troggle import DataIssue # circular import. Hmm
|
||||||
|
@ -10,8 +10,8 @@ from django.conf import settings
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
from troggle.core.models.troggle import DataIssue
|
|
||||||
from troggle.core.models.caves import get_cave_leniently
|
from troggle.core.models.caves import get_cave_leniently
|
||||||
|
from troggle.core.models.troggle import DataIssue
|
||||||
|
|
||||||
# from troggle.core.models.survex import SurvexBlock
|
# from troggle.core.models.survex import SurvexBlock
|
||||||
# from troggle.core.models.troggle import DataIssue # circular import. Hmm
|
# from troggle.core.models.troggle import DataIssue # circular import. Hmm
|
||||||
|
@ -2,15 +2,13 @@ import hashlib
|
|||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import re
|
|
||||||
import random
|
import random
|
||||||
|
import re
|
||||||
import resource
|
import resource
|
||||||
import string
|
import string
|
||||||
import subprocess
|
import subprocess
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
from decimal import getcontext
|
from decimal import getcontext
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth import authenticate
|
from django.contrib.auth import authenticate, login, logout
|
||||||
from django.contrib.auth import forms as auth_forms
|
from django.contrib.auth import forms as auth_forms
|
||||||
from django.contrib.auth import login, logout
|
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.http import HttpResponse, HttpResponseRedirect
|
from django.http import HttpResponse, HttpResponseRedirect
|
||||||
from django.shortcuts import redirect, render
|
from django.shortcuts import redirect, render
|
||||||
|
@ -1,32 +1,29 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import django
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
import zipfile
|
|
||||||
import urllib
|
import urllib
|
||||||
from bs4 import BeautifulSoup
|
import zipfile
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
import django
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
|
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
|
||||||
from django.http import HttpResponse, HttpResponseNotFound, HttpResponseRedirect, FileResponse
|
from django.http import FileResponse, HttpResponse, HttpResponseNotFound, HttpResponseRedirect
|
||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import redirect, render
|
||||||
|
from django.template import loader
|
||||||
from django.urls import NoReverseMatch, reverse
|
from django.urls import NoReverseMatch, reverse
|
||||||
|
from django.utils.safestring import mark_safe
|
||||||
|
|
||||||
import troggle.settings as settings
|
import troggle.settings as settings
|
||||||
from troggle.core.forms import CaveForm, EntranceForm, EntranceLetterForm # CaveAndEntranceFormSet,
|
from troggle.core.forms import CaveForm, EntranceForm, EntranceLetterForm # CaveAndEntranceFormSet,
|
||||||
from troggle.core.models.caves import Cave, CaveAndEntrance, Entrance, GetCaveLookup, get_cave_leniently
|
from troggle.core.models.caves import Cave, CaveAndEntrance, Entrance, GetCaveLookup, get_cave_leniently
|
||||||
from troggle.core.models.logbooks import QM
|
from troggle.core.models.logbooks import QM
|
||||||
from troggle.core.models.wallets import Wallet
|
from troggle.core.models.wallets import Wallet
|
||||||
from troggle.core.utils import write_and_commit
|
from troggle.core.utils import current_expo, write_and_commit
|
||||||
from troggle.core.utils import current_expo
|
|
||||||
from troggle.core.views import expo
|
from troggle.core.views import expo
|
||||||
from troggle.settings import CAVEDESCRIPTIONS, ENTRANCEDESCRIPTIONS
|
|
||||||
from troggle.parsers.caves import read_cave, read_entrance
|
from troggle.parsers.caves import read_cave, read_entrance
|
||||||
|
from troggle.settings import CAVEDESCRIPTIONS, ENTRANCEDESCRIPTIONS
|
||||||
from django.template import loader
|
|
||||||
from django.utils.safestring import mark_safe
|
|
||||||
|
|
||||||
from .auth import login_required_if_public
|
from .auth import login_required_if_public
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ import io
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import django.forms as forms
|
import django.forms as forms
|
||||||
|
import piexif
|
||||||
from django.http import JsonResponse
|
from django.http import JsonResponse
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.template import loader
|
from django.template import loader
|
||||||
@ -9,8 +10,6 @@ from django.urls import reverse
|
|||||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
import piexif
|
|
||||||
|
|
||||||
import troggle.settings as settings
|
import troggle.settings as settings
|
||||||
from troggle.core.utils import WriteAndCommitError, write_and_commit
|
from troggle.core.utils import WriteAndCommitError, write_and_commit
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ from django.views.decorators.csrf import ensure_csrf_cookie
|
|||||||
import troggle.core.views.caves
|
import troggle.core.views.caves
|
||||||
import troggle.settings as settings
|
import troggle.settings as settings
|
||||||
from troggle.core.models.caves import Cave
|
from troggle.core.models.caves import Cave
|
||||||
from troggle.core.utils import WriteAndCommitError, write_and_commit, current_expo
|
from troggle.core.utils import WriteAndCommitError, current_expo, write_and_commit
|
||||||
from troggle.core.views.editor_helpers import HTMLarea
|
from troggle.core.views.editor_helpers import HTMLarea
|
||||||
from troggle.core.views.uploads import edittxtpage
|
from troggle.core.views.uploads import edittxtpage
|
||||||
|
|
||||||
|
@ -1,20 +1,17 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.shortcuts import render
|
from django.shortcuts import redirect, render
|
||||||
from django.views.generic.list import ListView
|
from django.views.generic.list import ListView
|
||||||
from django.shortcuts import render, redirect
|
|
||||||
|
|
||||||
|
|
||||||
import troggle.settings as settings
|
import troggle.settings as settings
|
||||||
from troggle.core.models.logbooks import LogbookEntry, PersonLogEntry, QM, writelogbook
|
from troggle.core.models.logbooks import QM, LogbookEntry, PersonLogEntry, writelogbook
|
||||||
from troggle.core.models.survex import SurvexBlock, SurvexFile
|
from troggle.core.models.survex import SurvexBlock, SurvexFile
|
||||||
from troggle.core.models.troggle import Expedition, Person
|
from troggle.core.models.troggle import Expedition, Person
|
||||||
from troggle.core.models.wallets import Wallet
|
from troggle.core.models.wallets import Wallet
|
||||||
from troggle.core.utils import TROG, current_expo
|
from troggle.core.utils import TROG, current_expo
|
||||||
from troggle.parsers.imports import import_logbook
|
from troggle.parsers.imports import import_logbook
|
||||||
|
|
||||||
|
|
||||||
"""These views are for logbook items when they appear in an 'expedition' page
|
"""These views are for logbook items when they appear in an 'expedition' page
|
||||||
and for persons: their individual pages and their perseonexpedition pages.
|
and for persons: their individual pages and their perseonexpedition pages.
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ from troggle.core.models.logbooks import LogbookEntry, writelogbook # , PersonL
|
|||||||
|
|
||||||
# from databaseReset import reinit_db # don't do this. databaseRest runs code *at import time*
|
# from databaseReset import reinit_db # don't do this. databaseRest runs code *at import time*
|
||||||
from troggle.core.models.troggle import Expedition
|
from troggle.core.models.troggle import Expedition
|
||||||
|
from troggle.core.utils import current_expo
|
||||||
from troggle.parsers.imports import (
|
from troggle.parsers.imports import (
|
||||||
import_caves,
|
import_caves,
|
||||||
import_drawingsfiles,
|
import_drawingsfiles,
|
||||||
@ -20,7 +21,7 @@ from troggle.parsers.imports import (
|
|||||||
import_survex,
|
import_survex,
|
||||||
import_surveyscans,
|
import_surveyscans,
|
||||||
)
|
)
|
||||||
from troggle.core.utils import current_expo
|
|
||||||
from .auth import login_required_if_public
|
from .auth import login_required_if_public
|
||||||
|
|
||||||
"""Utility functions and code to serve the control panel and individual user's
|
"""Utility functions and code to serve the control panel and individual user's
|
||||||
@ -37,11 +38,11 @@ def todos(request, module):
|
|||||||
"""produces todo text from module
|
"""produces todo text from module
|
||||||
We could automate this to find all those strings automatically
|
We could automate this to find all those strings automatically
|
||||||
"""
|
"""
|
||||||
from troggle.core.TESTS.tests import todo as tests
|
|
||||||
from troggle.core.forms import todo as forms
|
from troggle.core.forms import todo as forms
|
||||||
from troggle.core.middleware import todo as middleware
|
from troggle.core.middleware import todo as middleware
|
||||||
from troggle.core.models.caves import todo as modelcaves
|
from troggle.core.models.caves import todo as modelcaves
|
||||||
from troggle.core.models.logbooks import todo as modellogbooks
|
from troggle.core.models.logbooks import todo as modellogbooks
|
||||||
|
from troggle.core.TESTS.tests import todo as tests
|
||||||
from troggle.core.views.caves import todo as viewcaves
|
from troggle.core.views.caves import todo as viewcaves
|
||||||
from troggle.core.views.drawings import todo as viewdrawings
|
from troggle.core.views.drawings import todo as viewdrawings
|
||||||
from troggle.core.views.logbooks import todo as viewlogbooks
|
from troggle.core.views.logbooks import todo as viewlogbooks
|
||||||
|
@ -6,17 +6,15 @@ from django.conf import settings
|
|||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
|
||||||
from troggle.core.models.caves import GetCaveLookup
|
from troggle.core.models.caves import GetCaveLookup
|
||||||
from troggle.core.models.survex import SingleScan, SurvexBlock, SurvexPersonRole
|
from troggle.core.models.survex import SingleScan, SurvexBlock, SurvexPersonRole
|
||||||
from troggle.core.models.wallets import Wallet
|
|
||||||
from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition
|
from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition
|
||||||
|
from troggle.core.models.wallets import Wallet
|
||||||
|
from troggle.core.utils import DatabaseResetOngoing, current_expo
|
||||||
from troggle.core.views.expo import getmimetype
|
from troggle.core.views.expo import getmimetype
|
||||||
from troggle.parsers.caves import add_cave_to_pending_list
|
from troggle.parsers.caves import add_cave_to_pending_list
|
||||||
from troggle.parsers.people import GetPersonExpeditionNameLookup
|
from troggle.parsers.people import GetPersonExpeditionNameLookup
|
||||||
from troggle.parsers.survex import set_walletdate
|
from troggle.parsers.survex import set_walletdate
|
||||||
from troggle.core.utils import current_expo, DatabaseResetOngoing
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Note that caveifywallet() etc do NOT save the object to the db. They are ephemeral, just for the page rendering of the
|
Note that caveifywallet() etc do NOT save the object to the db. They are ephemeral, just for the page rendering of the
|
||||||
|
@ -7,11 +7,11 @@ from django.shortcuts import render
|
|||||||
import troggle.settings as settings
|
import troggle.settings as settings
|
||||||
from troggle.core.models.caves import Cave, Entrance
|
from troggle.core.models.caves import Cave, Entrance
|
||||||
from troggle.core.models.logbooks import LogbookEntry
|
from troggle.core.models.logbooks import LogbookEntry
|
||||||
from troggle.core.models.survex import SurvexStation, SurvexPersonRole
|
from troggle.core.models.survex import SurvexPersonRole, SurvexStation
|
||||||
from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition
|
from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition
|
||||||
from troggle.core.models.wallets import Wallet
|
from troggle.core.models.wallets import Wallet
|
||||||
from troggle.parsers.people import GetPersonExpeditionNameLookup, foreign_friends
|
|
||||||
from troggle.core.utils import current_expo
|
from troggle.core.utils import current_expo
|
||||||
|
from troggle.parsers.people import GetPersonExpeditionNameLookup, foreign_friends
|
||||||
|
|
||||||
# from django.views.generic.list import ListView
|
# from django.views.generic.list import ListView
|
||||||
"""Very simple report pages summarizing data about the whole set of expeditions and of
|
"""Very simple report pages summarizing data about the whole set of expeditions and of
|
||||||
|
@ -3,24 +3,23 @@ import difflib
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
from pathlib import Path
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
|
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||||
|
|
||||||
import troggle.settings as settings
|
import troggle.settings as settings
|
||||||
from troggle.core.models.logbooks import LogbookEntry
|
|
||||||
from troggle.core.models.caves import Cave, GetCaveLookup
|
from troggle.core.models.caves import Cave, GetCaveLookup
|
||||||
from troggle.core.models.survex import SurvexFile, SurvexBlock #, SurvexDirectory
|
from troggle.core.models.logbooks import LogbookEntry
|
||||||
|
from troggle.core.models.survex import SurvexBlock, SurvexFile #, SurvexDirectory
|
||||||
from troggle.core.models.wallets import Wallet
|
from troggle.core.models.wallets import Wallet
|
||||||
from troggle.core.utils import only_commit, current_expo
|
from troggle.core.utils import current_expo, only_commit
|
||||||
from troggle.parsers.survex import parse_one_file
|
from troggle.parsers.survex import parse_one_file
|
||||||
|
|
||||||
"""Everything that views survexfiles
|
"""Everything that views survexfiles
|
||||||
|
@ -1,23 +1,21 @@
|
|||||||
import subprocess
|
import subprocess
|
||||||
from datetime import datetime, timezone, timedelta
|
from datetime import datetime, timedelta, timezone
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.core.files.storage import FileSystemStorage
|
from django.core.files.storage import FileSystemStorage
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import redirect, render
|
||||||
|
|
||||||
import settings
|
import settings
|
||||||
|
|
||||||
from troggle.core.models.caves import GetCaveLookup
|
from troggle.core.models.caves import GetCaveLookup
|
||||||
from troggle.core.models.logbooks import LogbookEntry, writelogbook, PersonLogEntry
|
from troggle.core.models.logbooks import LogbookEntry, PersonLogEntry, writelogbook
|
||||||
from troggle.core.models.survex import DrawingFile
|
from troggle.core.models.survex import DrawingFile
|
||||||
from troggle.core.models.troggle import DataIssue, Expedition, PersonExpedition
|
from troggle.core.models.troggle import DataIssue, Expedition, PersonExpedition
|
||||||
from troggle.core.utils import alphabet_suffix, current_expo, sanitize_name, unique_slug, write_and_commit
|
from troggle.core.utils import alphabet_suffix, current_expo, sanitize_name, unique_slug, write_and_commit
|
||||||
from troggle.parsers.people import GetPersonExpeditionNameLookup, known_foreigner
|
from troggle.parsers.people import GetPersonExpeditionNameLookup, known_foreigner
|
||||||
|
|
||||||
# from databaseReset import reinit_db # don't do this. databaseRest runs code *at import time*
|
# from databaseReset import reinit_db # don't do this. databaseRest runs code *at import time*
|
||||||
|
|
||||||
from .auth import login_required_if_public
|
from .auth import login_required_if_public
|
||||||
|
|
||||||
"""File upload 'views'
|
"""File upload 'views'
|
||||||
|
@ -14,24 +14,18 @@ from django.http import HttpResponseRedirect
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
import settings
|
import settings
|
||||||
from troggle.core.utils import current_expo, sanitize_name
|
|
||||||
|
|
||||||
from troggle.core.models.caves import Cave
|
from troggle.core.models.caves import Cave
|
||||||
from troggle.core.models.logbooks import LogbookEntry # , PersonLogEntry
|
from troggle.core.models.logbooks import LogbookEntry # , PersonLogEntry
|
||||||
from troggle.core.models.survex import SurvexBlock, SurvexFile, SurvexPersonRole
|
from troggle.core.models.survex import SurvexBlock, SurvexFile, SurvexPersonRole
|
||||||
from troggle.core.models.troggle import DataIssue, Expedition
|
from troggle.core.models.troggle import DataIssue, Expedition
|
||||||
from troggle.core.models.wallets import Wallet, YEAR_RANGE, make_valid_date
|
from troggle.core.models.wallets import YEAR_RANGE, Wallet, make_valid_date
|
||||||
|
from troggle.core.utils import current_expo, sanitize_name
|
||||||
from troggle.core.views.auth import login_required_if_public
|
from troggle.core.views.auth import login_required_if_public
|
||||||
from troggle.core.views.caves import getCave, get_cave_leniently
|
from troggle.core.views.caves import get_cave_leniently, getCave
|
||||||
from troggle.core.views.scans import caveifywallet, oldwallet
|
from troggle.core.views.scans import caveifywallet, oldwallet
|
||||||
from troggle.core.views.uploads import FilesForm
|
from troggle.core.views.uploads import FilesForm
|
||||||
|
|
||||||
from troggle.core.utils import current_expo
|
|
||||||
|
|
||||||
from troggle.parsers.scans import contentsjson
|
from troggle.parsers.scans import contentsjson
|
||||||
|
|
||||||
|
|
||||||
"""Main wallet editing form, which includes scan file upload into the wallet
|
"""Main wallet editing form, which includes scan file upload into the wallet
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -5,10 +5,11 @@ import resource
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import settings
|
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
from django.core.management.commands import flush
|
from django.core.management.commands import flush
|
||||||
|
|
||||||
|
import settings
|
||||||
|
|
||||||
""" Command-line utility for loading cave data files into troggle's database.
|
""" Command-line utility for loading cave data files into troggle's database.
|
||||||
|
|
||||||
The command line options select which combination of classes of data will be imported,
|
The command line options select which combination of classes of data will be imported,
|
||||||
|
@ -42,8 +42,7 @@ else:
|
|||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import get_models
|
from django.db.models import get_models
|
||||||
from django.db.models.fields.related import (ForeignKey, ManyToManyField,
|
from django.db.models.fields.related import ForeignKey, ManyToManyField, OneToOneField
|
||||||
OneToOneField)
|
|
||||||
from django.template import Context, Template
|
from django.template import Context, Template
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -2,7 +2,6 @@ import os
|
|||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -7,17 +7,16 @@ import time
|
|||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
import troggle.settings as settings
|
import troggle.settings as settings
|
||||||
from troggle.core.models.caves import Cave, Entrance
|
from troggle.core.models.caves import Cave, Entrance
|
||||||
from troggle.core.models.logbooks import QM
|
from troggle.core.models.logbooks import QM
|
||||||
from troggle.core.models.survex import SurvexBlock, SurvexFile, SurvexPersonRole, SurvexStation
|
from troggle.core.models.survex import SurvexBlock, SurvexFile, SurvexPersonRole, SurvexStation
|
||||||
from troggle.core.models.wallets import Wallet
|
|
||||||
from troggle.core.models.troggle import DataIssue, Expedition
|
from troggle.core.models.troggle import DataIssue, Expedition
|
||||||
|
from troggle.core.models.wallets import Wallet
|
||||||
from troggle.core.utils import chaosmonkey, get_process_memory
|
from troggle.core.utils import chaosmonkey, get_process_memory
|
||||||
from troggle.parsers.logbooks import GetCaveLookup
|
from troggle.parsers.logbooks import GetCaveLookup
|
||||||
from troggle.parsers.people import GetPersonExpeditionNameLookup, known_foreigner
|
from troggle.parsers.people import GetPersonExpeditionNameLookup, known_foreigner
|
||||||
from troggle.parsers.survex import stash_data_issue, store_data_issues, ROOTBLOCK
|
from troggle.parsers.survex import ROOTBLOCK, stash_data_issue, store_data_issues
|
||||||
|
|
||||||
"""Uses the imported data to find the locations of the survey stations labelled as
|
"""Uses the imported data to find the locations of the survey stations labelled as
|
||||||
entrances
|
entrances
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
import string
|
import string
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from random import randint
|
from random import randint
|
||||||
@ -11,11 +10,11 @@ from random import randint
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.template.defaultfilters import slugify
|
from django.template.defaultfilters import slugify
|
||||||
|
|
||||||
from parsers.people import GetPersonExpeditionNameLookup, load_people_expos, known_foreigner
|
from parsers.people import GetPersonExpeditionNameLookup, known_foreigner, load_people_expos
|
||||||
from troggle.core.models.caves import GetCaveLookup
|
from troggle.core.models.caves import GetCaveLookup
|
||||||
from troggle.core.models.logbooks import LogbookEntry, PersonLogEntry
|
from troggle.core.models.logbooks import LogbookEntry, PersonLogEntry
|
||||||
from troggle.core.models.troggle import DataIssue, Expedition
|
from troggle.core.models.troggle import DataIssue, Expedition
|
||||||
from troggle.core.utils import get_process_memory, alphabet_suffix, unique_slug
|
from troggle.core.utils import alphabet_suffix, get_process_memory, unique_slug
|
||||||
|
|
||||||
EPOCH = settings.EPOCH
|
EPOCH = settings.EPOCH
|
||||||
"""
|
"""
|
||||||
|
@ -3,9 +3,9 @@ import os
|
|||||||
import re
|
import re
|
||||||
from html import unescape
|
from html import unescape
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from unidecode import unidecode
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from unidecode import unidecode
|
||||||
|
|
||||||
from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition
|
from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition
|
||||||
|
|
||||||
|
@ -11,12 +11,10 @@ import troggle.settings as settings
|
|||||||
from troggle.core.models.caves import Cave, Entrance, GetCaveLookup
|
from troggle.core.models.caves import Cave, Entrance, GetCaveLookup
|
||||||
from troggle.core.models.logbooks import QM
|
from troggle.core.models.logbooks import QM
|
||||||
from troggle.core.models.survex import SurvexBlock, SurvexFile, SurvexPersonRole, SurvexStation
|
from troggle.core.models.survex import SurvexBlock, SurvexFile, SurvexPersonRole, SurvexStation
|
||||||
from troggle.core.models.wallets import Wallet
|
|
||||||
from troggle.core.models.troggle import DataIssue, Expedition
|
from troggle.core.models.troggle import DataIssue, Expedition
|
||||||
from troggle.core.utils import chaosmonkey, get_process_memory
|
from troggle.core.models.wallets import Wallet
|
||||||
from troggle.core.utils import write_and_commit
|
from troggle.core.utils import chaosmonkey, get_process_memory, write_and_commit
|
||||||
|
from troggle.parsers.caves import AREACODES, ARGEAREAS, create_new_cave, do_ARGE_cave
|
||||||
from troggle.parsers.caves import create_new_cave, do_ARGE_cave, AREACODES, ARGEAREAS
|
|
||||||
from troggle.parsers.people import GetPersonExpeditionNameLookup, known_foreigner
|
from troggle.parsers.people import GetPersonExpeditionNameLookup, known_foreigner
|
||||||
|
|
||||||
"""Imports the tree of survex files following from a defined root .svx file
|
"""Imports the tree of survex files following from a defined root .svx file
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import os
|
import os
|
||||||
import folium
|
|
||||||
from pathlib import Path
|
|
||||||
from PIL import Image, ExifTags
|
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import folium
|
||||||
|
from PIL import ExifTags, Image
|
||||||
|
|
||||||
"""To do
|
"""To do
|
||||||
- create gpx file for adding in to existing GPSprune maps
|
- create gpx file for adding in to existing GPSprune maps
|
||||||
|
Loading…
Reference in New Issue
Block a user