mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-24 16:21:53 +00:00
Update URLs to django documn version
This commit is contained in:
parent
19d9942676
commit
709b720be9
@ -16,7 +16,7 @@ But paths like this:
|
|||||||
which rely on database resolution will fail unless a fixture has been set up for
|
which rely on database resolution will fail unless a fixture has been set up for
|
||||||
them.
|
them.
|
||||||
|
|
||||||
https://docs.djangoproject.com/en/3.2/topics/testing/tools/
|
https://docs.djangoproject.com/en/dev/topics/testing/tools/
|
||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -16,7 +16,7 @@ But paths like this:
|
|||||||
which rely on database resolution will fail unless a fixture has been set up for
|
which rely on database resolution will fail unless a fixture has been set up for
|
||||||
them.
|
them.
|
||||||
|
|
||||||
https://docs.djangoproject.com/en/3.0/topics/testing/tools/
|
https://docs.djangoproject.com/en/dev/topics/testing/tools/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ class EntranceForm(ModelForm):
|
|||||||
# This next line is called from the templates/edit_cave2.html template.
|
# This next line is called from the templates/edit_cave2.html template.
|
||||||
# This is sufficient to create an entire entry for for the cave fields automatically
|
# This is sufficient to create an entire entry for for the cave fields automatically
|
||||||
# http://localhost:8000/cave/new/
|
# http://localhost:8000/cave/new/
|
||||||
# using django built-in Deep Magic. https://docs.djangoproject.com/en/3.2/topics/forms/modelforms/
|
# using django built-in Deep Magic. https://docs.djangoproject.com/en/dev/topics/forms/modelforms/
|
||||||
# for forms which map directly onto a Django Model
|
# for forms which map directly onto a Django Model
|
||||||
CaveAndEntranceFormSet = modelformset_factory(CaveAndEntrance, exclude=("cave",))
|
CaveAndEntranceFormSet = modelformset_factory(CaveAndEntrance, exclude=("cave",))
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ https://www.mattlayman.com/understand-django/command-apps/
|
|||||||
https://www.geeksforgeeks.org/custom-django-management-commands/
|
https://www.geeksforgeeks.org/custom-django-management-commands/
|
||||||
|
|
||||||
Django docs:
|
Django docs:
|
||||||
https://docs.djangoproject.com/en/3.2/howto/custom-management-commands/
|
https://docs.djangoproject.com/en/dev/howto/custom-management-commands/
|
||||||
|
|
||||||
We might use this mechanism to replace/enhance the
|
We might use this mechanism to replace/enhance the
|
||||||
folk, wallets and any cron jobs or other standalone scripts.
|
folk, wallets and any cron jobs or other standalone scripts.
|
||||||
|
@ -161,7 +161,7 @@ class Cave(TroggleModel):
|
|||||||
# qms = self.qm_set.all().order_by('expoyear', 'block__date')
|
# qms = self.qm_set.all().order_by('expoyear', 'block__date')
|
||||||
qms = QM.objects.filter(cave=self).order_by(
|
qms = QM.objects.filter(cave=self).order_by(
|
||||||
"expoyear", "block__date"
|
"expoyear", "block__date"
|
||||||
) # a QuerySet, see https://docs.djangoproject.com/en/4.0/ref/models/querysets/#order-by
|
) # a QuerySet, see https://docs.djangoproject.com/en/dev/ref/models/querysets/#order-by
|
||||||
return qms # a QuerySet
|
return qms # a QuerySet
|
||||||
|
|
||||||
def kat_area(self):
|
def kat_area(self):
|
||||||
|
@ -288,7 +288,7 @@ def scansingle(request, path, file):
|
|||||||
|
|
||||||
def allscans(request):
|
def allscans(request):
|
||||||
"""Returns all the wallets in the system, we would like to use
|
"""Returns all the wallets in the system, we would like to use
|
||||||
the Django queryset SQL optimisation https://docs.djangoproject.com/en/3.2/ref/models/querysets/#prefetch-related
|
the Django queryset SQL optimisation https://docs.djangoproject.com/en/dev/ref/models/querysets/#prefetch-related
|
||||||
to get the related singlescan and survexblock objects but that requires rewriting this to do the query on those, not on
|
to get the related singlescan and survexblock objects but that requires rewriting this to do the query on those, not on
|
||||||
the wallets
|
the wallets
|
||||||
"""
|
"""
|
||||||
|
@ -39,7 +39,7 @@ todo = """
|
|||||||
file_in = open(logbookfile,'rb')
|
file_in = open(logbookfile,'rb')
|
||||||
txt = file_in.read().decode("latin1")
|
txt = file_in.read().decode("latin1")
|
||||||
|
|
||||||
- use Fixtures https://docs.djangoproject.com/en/4.1/ref/django-admin/#django-admin-loaddata to cache
|
- use Fixtures https://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-loaddata to cache
|
||||||
data for old logbooks? Not worth it..
|
data for old logbooks? Not worth it..
|
||||||
"""
|
"""
|
||||||
MAX_LOGBOOK_ENTRY_TITLE_LENGTH = 200
|
MAX_LOGBOOK_ENTRY_TITLE_LENGTH = 200
|
||||||
|
@ -2091,7 +2091,7 @@ def LoadSurvexBlocks():
|
|||||||
# why does this increase memory use by 20 MB ?!
|
# why does this increase memory use by 20 MB ?!
|
||||||
# We have foreign keys, Django needs to load the related objects
|
# We have foreign keys, Django needs to load the related objects
|
||||||
# in order to resolve how the relation should handle the deletion:
|
# in order to resolve how the relation should handle the deletion:
|
||||||
# https://docs.djangoproject.com/en/3.2/ref/models/fields/#django.db.models.ForeignKey.on_delete
|
# https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey.on_delete
|
||||||
SurvexBlock.objects.all().delete()
|
SurvexBlock.objects.all().delete()
|
||||||
SurvexFile.objects.all().delete()
|
SurvexFile.objects.all().delete()
|
||||||
SurvexDirectory.objects.all().delete()
|
SurvexDirectory.objects.all().delete()
|
||||||
|
@ -26,7 +26,7 @@ GIT = "git" # command for running git
|
|||||||
# Note that this builds upon the django system installed
|
# Note that this builds upon the django system installed
|
||||||
# global settings in
|
# global settings in
|
||||||
# django/conf/global_settings.py which is automatically loaded first.
|
# django/conf/global_settings.py which is automatically loaded first.
|
||||||
# read https://docs.djangoproject.com/en/3.0/topics/settings/
|
# read https://docs.djangoproject.com/en/dev/topics/settings/
|
||||||
|
|
||||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
# BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
# BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||||
@ -104,9 +104,9 @@ INSTALLED_APPS = (
|
|||||||
|
|
||||||
FORM_RENDERER = "django.forms.renderers.TemplatesSetting" # Required to customise widget templates
|
FORM_RENDERER = "django.forms.renderers.TemplatesSetting" # Required to customise widget templates
|
||||||
|
|
||||||
# See the recommended order of these in https://docs.djangoproject.com/en/2.2/ref/middleware/
|
# See the recommended order of these in https://docs.djangoproject.com/en/dev/ref/middleware/
|
||||||
# Note that this is a radically different onion architecture from earlier versions though it looks the same,
|
# Note that this is a radically different onion architecture from earlier versions though it looks the same,
|
||||||
# see https://docs.djangoproject.com/en/2.0/topics/http/middleware/#upgrading-pre-django-1-10-style-middleware
|
# see https://docs.djangoproject.com/en/dev/topics/http/middleware/#upgrading-pre-django-1-10-style-middleware
|
||||||
# Seriously, read this: https://www.webforefront.com/django/middlewaredjango.html which is MUCH BETTER than the docs
|
# Seriously, read this: https://www.webforefront.com/django/middlewaredjango.html which is MUCH BETTER than the docs
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
#'django.middleware.security.SecurityMiddleware', # SECURE_SSL_REDIRECT and SECURE_SSL_HOST # we don't use this
|
#'django.middleware.security.SecurityMiddleware', # SECURE_SSL_REDIRECT and SECURE_SSL_HOST # we don't use this
|
||||||
|
@ -25,7 +25,7 @@ otherwise they come from *ref statements in survex files as of the most recent d
|
|||||||
{% endfor %}</ul>
|
{% endfor %}</ul>
|
||||||
|
|
||||||
<!-- This should all be restructured to use .prefetch_related() and .select_related()
|
<!-- This should all be restructured to use .prefetch_related() and .select_related()
|
||||||
see https://docs.djangoproject.com/en/3.2/ref/models/querysets/#prefetch-related
|
see https://docs.djangoproject.com/en/dev/ref/models/querysets/#prefetch-related
|
||||||
-->
|
-->
|
||||||
<table width=95%>
|
<table width=95%>
|
||||||
<tr><th>Scans folder</th><th>Files</th><th>Survex blocks</th><th>Cave</th></tr>
|
<tr><th>Scans folder</th><th>Files</th><th>Survex blocks</th><th>Cave</th></tr>
|
||||||
|
@ -72,7 +72,7 @@ If anyone really cares, they can always look in the original survex file
|
|||||||
e.g. see <a href="/personexpedition/Wookey/1999">Wookey 1999</a> where there are one eiscream survex block on 5th August in eiscream.svx
|
e.g. see <a href="/personexpedition/Wookey/1999">Wookey 1999</a> where there are one eiscream survex block on 5th August in eiscream.svx
|
||||||
<br>It duplicates it. Also on 4th Aug. there is only one block, but it gets shown twice.
|
<br>It duplicates it. Also on 4th Aug. there is only one block, but it gets shown twice.
|
||||||
|
|
||||||
<p>The interaction of django database query idioms with <a href="https://docs.djangoproject.com/en/1.11/ref/templates/api/">django HTML templating language</a> is a bit impenetrable here.
|
<p>The interaction of django database query idioms with <a href="https://docs.djangoproject.com/en/dev/ref/templates/api/">django HTML templating language</a> is a bit impenetrable here.
|
||||||
I blame Aaron Curtis who was too fond of being clever with the Django templating system
|
I blame Aaron Curtis who was too fond of being clever with the Django templating system
|
||||||
instead or writing it in python anyone could understand.<br>
|
instead or writing it in python anyone could understand.<br>
|
||||||
- The template is in <var>troggle/templates/personexpedition.html</var>
|
- The template is in <var>troggle/templates/personexpedition.html</var>
|
||||||
|
2
urls.py
2
urls.py
@ -103,7 +103,7 @@ trogglepatterns = [
|
|||||||
path('dwguploadnogit/<path:folder>', dwgupload, {'gitdisable': 'yes'}, name='dwguploadnogit'), # used in testing
|
path('dwguploadnogit/<path:folder>', dwgupload, {'gitdisable': 'yes'}, name='dwguploadnogit'), # used in testing
|
||||||
|
|
||||||
# setting LOGIN_URL = '/accounts/login/' is default.
|
# setting LOGIN_URL = '/accounts/login/' is default.
|
||||||
# NB setting url pattern name to 'login' instea dof 'expologin' with override Django, see https://docs.djangoproject.com/en/4.0/topics/http/urls/#naming-url-patterns
|
# NB setting url pattern name to 'login' instea dof 'expologin' with override Django, see https://docs.djangoproject.com/en/dev/topics/http/urls/#naming-url-patterns
|
||||||
path('accounts/logout/', expologout, name='expologout'), # same as in django.contrib.auth.urls
|
path('accounts/logout/', expologout, name='expologout'), # same as in django.contrib.auth.urls
|
||||||
path('accounts/login/', expologin, name='expologin'), # same as in django.contrib.auth.urls
|
path('accounts/login/', expologin, name='expologin'), # same as in django.contrib.auth.urls
|
||||||
#re_path(r'^accounts/', include('django.contrib.auth.urls')), # see site-packages\registration\auth_urls_classes.py
|
#re_path(r'^accounts/', include('django.contrib.auth.urls')), # see site-packages\registration\auth_urls_classes.py
|
||||||
|
2
wsgi.py
2
wsgi.py
@ -4,7 +4,7 @@ WSGI config for mysite project.
|
|||||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||||
|
|
||||||
For more information on this file, see
|
For more information on this file, see
|
||||||
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
|
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
Loading…
Reference in New Issue
Block a user