From ffb5d7bdda5e35478a914ee822039f629b3af0fc Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Wed, 11 Apr 2018 22:02:57 +0100 Subject: [PATCH] Upgrade to django 1.5, some functions have been changed url in templates now requires quotes roung the first arg USE_TZ added --- middleware.py | 2 +- profiles/views.py | 2 +- settings.py | 1 + templates/base.html | 40 +++++++++---------- templates/cave.html | 4 +- templates/cave_entrances.html | 4 +- templates/caveindex.html | 2 +- templates/controlPanel.html | 6 +-- templates/editfile.html | 8 ++-- templates/expedition.html | 6 +-- templates/expowebbase.html | 16 ++++---- templates/flatpage.html | 2 +- templates/frontpage.html | 2 +- templates/index.html | 18 ++++----- templates/listdir.html | 6 +-- templates/logbookentry.html | 2 +- templates/menu.html | 4 +- templates/pagenotfound.html | 2 +- templates/personexpedition.html | 2 +- templates/registration/activate.html | 4 +- templates/registration/activation_email.html | 2 +- templates/registration/activation_email.txt | 2 +- templates/registration/registration_form.html | 2 +- templates/survexblock.html | 6 +-- templates/survexscansfolder.html | 2 +- templates/survexscansfolders.html | 2 +- templates/survey.html | 4 +- templates/svxcavesingle.html | 4 +- templates/svxfile.html | 2 +- templates/svxfilecavelist.html | 18 ++++----- templates/svxfiledifflistonly.html | 2 +- templates/todo.html | 18 ++++----- templates/tunnelfiles.html | 4 +- urls.py | 6 +-- 34 files changed, 104 insertions(+), 103 deletions(-) diff --git a/middleware.py b/middleware.py index 15dd039..7c27500 100644 --- a/middleware.py +++ b/middleware.py @@ -19,7 +19,7 @@ class SmartAppendSlashMiddleware(object): """ # Check for a redirect based on settings.SMART_APPEND_SLASH - host = http.get_host(request) + host = http.HttpRequest.get_host(request) old_url = [host, request.path] new_url = old_url[:] # Append a slash if SMART_APPEND_SLASH is set and the resulting URL diff --git a/profiles/views.py b/profiles/views.py index dec1172..c9552ab 100644 --- a/profiles/views.py +++ b/profiles/views.py @@ -11,7 +11,7 @@ from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404 from django.shortcuts import render_to_response from django.template import RequestContext -from django.views.generic.list_detail import object_list +from django.views.generic.list import ListView from django import forms from core.models import Person diff --git a/settings.py b/settings.py index 670c84c..fb045f9 100644 --- a/settings.py +++ b/settings.py @@ -18,6 +18,7 @@ MANAGERS = ADMINS # although not all choices may be available on all operating systems. # If running in a Windows environment this must be set to the same as your # system time zone. +USE_TZ = True TIME_ZONE = 'Europe/London' # Language code for this installation. All choices can be found here: diff --git a/templates/base.html b/templates/base.html index 8a3977e..11568af 100644 --- a/templates/base.html +++ b/templates/base.html @@ -22,9 +22,9 @@ {% if user.username %} You are logged in as {{ user.username }} {% if user.person %}({{ user.person }}) - {% else %}sort your profile + {% else %}sort your profile {% endif %}. - | Log out {% else %} Sign up | Log in {% endif %} + | Log out {% else %} Sign up | Log in {% endif %} {% endblock%} {% block editLink %} @@ -32,17 +32,17 @@ @@ -85,24 +85,24 @@
  • Expedition website
  • -
  • Troggle front page
  • -
  • caves
  • -
  • cavers
  • +
  • Troggle front page
  • +
  • caves
  • +
  • cavers
  • expeditions
  • -
  • survey binder
  • +
  • survey binder
  • diversions
  • admin
  • hide menu
  • diff --git a/templates/cave.html b/templates/cave.html index 5bd77f6..358ad89 100644 --- a/templates/cave.html +++ b/templates/cave.html @@ -36,7 +36,7 @@ {{ ent.entrance_letter|safe }} {% if ent.entrance.name %} {{ ent.entrance.name|safe }} - {% endif %}Edit + {% endif %}Edit
    {% if ent.entrance.marking %}
    Marking
    {{ ent.entrance.marking_val|safe }}
    @@ -96,7 +96,7 @@ {% endif %}

    -New Entrance +New Entrance
    diff --git a/templates/cave_entrances.html b/templates/cave_entrances.html index 5b70196..e3a571f 100644 --- a/templates/cave_entrances.html +++ b/templates/cave_entrances.html @@ -7,7 +7,7 @@ {{ ent.entrance_letter|safe }} {% if ent.entrance.name %} {{ ent.entrance.name|safe }} - {% endif %}Edit + {% endif %}Edit
    {% if ent.entrance.marking %}
    Marking
    {{ ent.entrance.marking_val|safe }}
    @@ -67,5 +67,5 @@ {% endif %}

    -New Entrance +New Entrance
    diff --git a/templates/caveindex.html b/templates/caveindex.html index fe141ed..d99f452 100644 --- a/templates/caveindex.html +++ b/templates/caveindex.html @@ -34,6 +34,6 @@ {% endfor %} -New Cave +New Cave {% endblock %} diff --git a/templates/controlPanel.html b/templates/controlPanel.html index 7d37887..327af13 100644 --- a/templates/controlPanel.html +++ b/templates/controlPanel.html @@ -68,7 +68,7 @@ -
    +

    Download a CAVETAB2.CSV file which is dynamically generated by Troggle.

    @@ -83,7 +83,7 @@ -
    +

    Download a logbook file which is dynamically generated by Troggle.

    @@ -120,7 +120,7 @@

    -
    +

    Download a Surveys.csv file which is dynamically generated by Troggle.

    diff --git a/templates/editfile.html b/templates/editfile.html index c420654..64f1fba 100644 --- a/templates/editfile.html +++ b/templates/editfile.html @@ -6,16 +6,16 @@ $(function() { $("#id_date").datepicker({dateFormat: "yy-mm-dd"}); $("#id_cave").change(function() { - $('#id_entrance').load('{% url get_entrances caveslug="" %}' + this.value); + $('#id_entrance').load('{% url "get_entrances" caveslug="" %}' + this.value); }); $("#id_cave").change(function() { - $('#id_qm').load('{% url get_qms caveslug="" %}' + this.value); + $('#id_qm').load('{% url "get_qms" caveslug="" %}' + this.value); }); $("#id_expedition").change(function() { - $('#id_logbookentry').load('{% url get_logbook_entries expeditionslug="" %}' + this.value); + $('#id_logbookentry').load('{% url "get_logbook_entries" expeditionslug="" %}' + this.value); }); $("#id_expedition").change(function() { - $('#id_person').load('{% url get_people expeditionslug="" %}' + this.value); + $('#id_person').load('{% url "get_people" expeditionslug="" %}' + this.value); }); }); diff --git a/templates/expedition.html b/templates/expedition.html index 4fab025..548dc4f 100644 --- a/templates/expedition.html +++ b/templates/expedition.html @@ -51,7 +51,7 @@ an "S" for a survey trip. The colours are the same for people on the same trip. {% endfor %}
    {% for survexblock in persondayactivities.survexblocks %} - S + S {% endfor %} {% else %} @@ -67,7 +67,7 @@ an "S" for a survey trip. The colours are the same for people on the same trip.

    Logbooks and survey trips per day

    -New logbook entry +New logbook entry {% regroup dateditems|dictsort:"date" by date as dates %} @@ -78,7 +78,7 @@ an "S" for a survey trip. The colours are the same for people on the same trip. {% if item.isLogbookEntry %}{{item.title|safe}}
    {% endif %} {% endfor %} {% endfor %} diff --git a/templates/expowebbase.html b/templates/expowebbase.html index 5d5b424..becdb05 100644 --- a/templates/expowebbase.html +++ b/templates/expowebbase.html @@ -16,14 +16,14 @@
  • Cave index
  • {% if cavepage %} {% endif %} diff --git a/templates/flatpage.html b/templates/flatpage.html index 47863e3..2376159 100644 --- a/templates/flatpage.html +++ b/templates/flatpage.html @@ -3,5 +3,5 @@ {% block bodyattrs %}{% if homepage %} id="homepage"{% endif %}{% endblock %} {% block body %} {{ body|safe }} -{% if homepage %}{% if editable %}Edit{% endif %}{%else %}{% include "menu.html" %}{% endif %} +{% if homepage %}{% if editable %}Edit{% endif %}{%else %}{% include "menu.html" %}{% endif %} {% endblock %} diff --git a/templates/frontpage.html b/templates/frontpage.html index 2c1456c..bad3ce5 100644 --- a/templates/frontpage.html +++ b/templates/frontpage.html @@ -57,7 +57,7 @@ Everyone is gearing up for the 2009 expedition; please see the link below for th

    Troggle development

    -Troggle is still under development. Check out the development page on google code, where you can file bug reports, make suggestions, and help develop the code. There is also an old todo list at here. +Troggle is still under development. Check out the development page on google code, where you can file bug reports, make suggestions, and help develop the code. There is also an old todo list at here.

    {% endblock content %} diff --git a/templates/index.html b/templates/index.html index c0974e8..614c180 100644 --- a/templates/index.html +++ b/templates/index.html @@ -8,14 +8,14 @@

    The unfinished front page

    Further work

    @@ -50,7 +50,7 @@ {% endif %} diff --git a/templates/pagenotfound.html b/templates/pagenotfound.html index 03569de..4fdfe2a 100644 --- a/templates/pagenotfound.html +++ b/templates/pagenotfound.html @@ -2,6 +2,6 @@ {% block title %}Page not found {{ path }}{% endblock %} {% block body %}

    Page not found {{ path }}

    -Create this page. +Create this page. {% include "menu.html" %} {% endblock %} diff --git a/templates/personexpedition.html b/templates/personexpedition.html index b88f44e..30d071b 100644 --- a/templates/personexpedition.html +++ b/templates/personexpedition.html @@ -39,7 +39,7 @@ {% endif %} {% if persondate.2 %} - + diff --git a/templates/survey.html b/templates/survey.html index 9dca0df..13a8800 100644 --- a/templates/survey.html +++ b/templates/survey.html @@ -24,11 +24,11 @@ }); function redirectSurvey(){ - window.location = "{% url survey %}" + '/' + document.getElementById("expeditionChooser").value + "%23" + document.getElementById("surveyChooser").value; + window.location = "{% url "survey" %}" + '/' + document.getElementById("expeditionChooser").value + "%23" + document.getElementById("surveyChooser").value; } function redirectYear(){ - window.location = "{% url survey %}" + '/' + document.getElementById("expeditionChooser").value + "%23"; + window.location = "{% url "survey" %}" + '/' + document.getElementById("expeditionChooser").value + "%23"; } diff --git a/templates/svxcavesingle.html b/templates/svxcavesingle.html index 1d24466..ad5540f 100644 --- a/templates/svxcavesingle.html +++ b/templates/svxcavesingle.html @@ -29,9 +29,9 @@ {% endif %} {% ifequal survexfile survexdirectory.primarysurvexfile %} - {{survexfile.path}} + {{survexfile.path}} {% else %} - {{survexfile.path}} + {{survexfile.path}} {% endifequal %} diff --git a/templates/svxfile.html b/templates/svxfile.html index fbaacdd..e1ed097 100644 --- a/templates/svxfile.html +++ b/templates/svxfile.html @@ -62,7 +62,7 @@ $(document).ready(function() {% if logmessage %} {% if has_3d %} -

    3d file

    +

    3d file

    {% else %}

    No 3d file

    {% endif %} diff --git a/templates/svxfilecavelist.html b/templates/svxfilecavelist.html index 52c8e83..2f80d46 100644 --- a/templates/svxfilecavelist.html +++ b/templates/svxfilecavelist.html @@ -12,23 +12,23 @@

    Caves with subdirectories

    {% for subdircave, cavefiles, subsurvdirs in subdircaves %} -

    {{cavefiles.0.1}} - dates and explorers

    +

    {{cavefiles.0.1}} - dates and explorers

    DateLogged tripsSurveys
    {% for item in date.list %} - {% if item.isSurvexBlock %}{{item.name}}
    {% endif %} + {% if item.isSurvexBlock %}{{item.name}}
    {% endif %} {% endfor %}
    {{persondate.2}}{{persondate.2}} {% for survexpersonrole in persondate.2.survexpersonrole_set.all %} {{survexpersonrole.nrole}} diff --git a/templates/registration/activate.html b/templates/registration/activate.html index 3f95a18..cf8e79a 100644 --- a/templates/registration/activate.html +++ b/templates/registration/activate.html @@ -12,11 +12,11 @@ New troggle account registered {% if account %}

    -Hello, {{ account }}! Your account is now activated. Now you can log in with the password you chose. Use the links in the upper right to control this in the future. +Hello, {{ account }}! Your account is now activated. Now you can log in with the password you chose. Use the links in the upper right to control this in the future.

    -If you have been on the expedition in the past, you already have a profile in the system; click here to find it and link it to your account. Otherwise, please create yourself a new profile. +If you have been on the expedition in the past, you already have a profile in the system; click here to find it and link it to your account. Otherwise, please create yourself a new profile.

    {% else %} diff --git a/templates/registration/activation_email.html b/templates/registration/activation_email.html index abb0ad1..3b82c60 100644 --- a/templates/registration/activation_email.html +++ b/templates/registration/activation_email.html @@ -2,7 +2,7 @@

    Glad you're joining the CUCC EXPO team! Please go to

    -

    {{ site }}{% url registration_activate activation_key %}

    +

    {{ site }}{% url "registration_activate" activation_key %}

    to activate your account. Do this within {{ expiration_days }} days, or else you'll have to sign up again.

    diff --git a/templates/registration/activation_email.txt b/templates/registration/activation_email.txt index 9b240c2..bce7fbe 100644 --- a/templates/registration/activation_email.txt +++ b/templates/registration/activation_email.txt @@ -2,7 +2,7 @@ Hello {{ form.user }}, Glad you're joining the CUCC EXPO team! Please go to -{{ site }}{% url registration_activate activation_key %} +{{ site }}{% url "registration_activate" activation_key %} to activate your account. Do this within {{ expiration_days }} days, or else you'll have to sign up again. diff --git a/templates/registration/registration_form.html b/templates/registration/registration_form.html index f82c6cb..6c4a7f6 100644 --- a/templates/registration/registration_form.html +++ b/templates/registration/registration_form.html @@ -9,7 +9,7 @@ registration_form.html | {{ block.super }} {% endblock %} {% block content %} -
    {% csrf_token %} +{% csrf_token %} {% for error in form.non_field_errors %} {{ error }} {% endfor %} diff --git a/templates/survexblock.html b/templates/survexblock.html index c4c1066..b159956 100644 --- a/templates/survexblock.html +++ b/templates/survexblock.html @@ -8,7 +8,7 @@ {% block content %}

    Survex Block {{survexblock.survexpath}}

    -

    Link to {{survexblock.survexfile.path}}

    +

    Link to {{survexblock.survexfile.path}}

    Needs duplicates removed from right hand column

    Needs links to survex file presentation

    @@ -18,13 +18,13 @@ {% if survexblock.parent %}

    Survey block above:

    -

    {{survexblock.parent.survexpath}}

    +

    {{survexblock.parent.survexpath}}

    {% endif %} {% if survexblock.survexblock_set.all %}

    Survey blocks below:

    {% for survexblockdown in survexblock.survexblock_set.all %} -

    {{survexblockdown.survexpath}}

    +

    {{survexblockdown.survexpath}}

    {% endfor %} {% endif %} diff --git a/templates/survexscansfolder.html b/templates/survexscansfolder.html index fe21916..339f639 100644 --- a/templates/survexscansfolder.html +++ b/templates/survexscansfolder.html @@ -25,7 +25,7 @@ {% for survexblock in survexscansfolder.survexblock_set.all %} - + {% endfor %}
    {{survexblock}}{{survexblock}}
    diff --git a/templates/survexscansfolders.html b/templates/survexscansfolders.html index 597bacf..187f3f0 100644 --- a/templates/survexscansfolders.html +++ b/templates/survexscansfolders.html @@ -15,7 +15,7 @@
    {{survexscansfolder.survexscansingle_set.all|length}} {% for survexblock in survexscansfolder.survexblock_set.all %} - {{survexblock}} + {{survexblock}} {% endfor %}
    - + {% for primarycavefile, subcavefiles in subsurvdirs %} - + @@ -44,12 +44,12 @@ {% for primarycavefile, subcavefiles in multifilecaves %} @@ -59,7 +59,7 @@

    Caves of one file

    {% for cavepath, cavename in onefilecaves %} - {{cavename}} + {{cavename}} {% endfor %}

    diff --git a/templates/svxfiledifflistonly.html b/templates/svxfiledifflistonly.html index 835125b..7b0367a 100644 --- a/templates/svxfiledifflistonly.html +++ b/templates/svxfiledifflistonly.html @@ -6,7 +6,7 @@ {% if logmessage %} {% if has_3d %} -

    3d file

    +

    3d file

    {% else %}

    No 3d file

    {% endif %} diff --git a/templates/todo.html b/templates/todo.html index a678f50..7482b72 100644 --- a/templates/todo.html +++ b/templates/todo.html @@ -8,14 +8,14 @@

    The unfinished front page

    Further work

    @@ -52,7 +52,7 @@ {% for tunnelfile in tunnelfiles %} - + @@ -31,7 +31,7 @@ diff --git a/urls.py b/urls.py index 48c9ea4..c26c4dd 100644 --- a/urls.py +++ b/urls.py @@ -6,9 +6,9 @@ from core.views_other import * from core.views_caves import * from core.views_survex import * from core.models import * -from django.views.generic.create_update import create_object +from django.views.generic.edit import UpdateView from django.contrib import admin -from django.views.generic.list_detail import object_list +from django.views.generic.list import ListView from django.contrib import admin admin.autodiscover() @@ -30,7 +30,7 @@ actualurlpatterns = patterns('', #url(r'^person/(\w+_\w+)$', views_logbooks.person, name="person"), url(r'^expedition/(\d+)$', views_logbooks.expedition, name="expedition"), - url(r'^expeditions/?$', object_list, {'queryset':Expedition.objects.all(),'template_name':'object_list.html'},name="expeditions"), + url(r'^expeditions/?$', ListView, {'queryset':Expedition.objects.all(),'template_name':'object_list.html'},name="expeditions"), url(r'^personexpedition/(?P[A-Z]*[a-z]*)[^a-zA-Z]*(?P[A-Z]*[a-z]*)/(?P\d+)/?$', views_logbooks.personexpedition, name="personexpedition"), url(r'^logbookentry/(?P.*)/(?P.*)/?$', views_logbooks.logbookentry,name="logbookentry"), url(r'^newlogbookentry/(?P.*)$', views_logbooks.newLogbookEntry, name="newLogBookEntry"),
    {{cavefiles.0.1}}{{cavefiles.0.1}} {% for cavepath, cavename in cavefiles.1 %} - {{cavename}} + {{cavename}} {% endfor %}
    {{primarycavefile.1}}{{primarycavefile.1}} {% for cavepath, cavename in subcavefiles %} - {{cavename}} + {{cavename}} {% endfor %}
    - {{primarycavefile.1}} + {{primarycavefile.1}} - {{primarycavefile.1}} - + {{primarycavefile.1}} - {% for cavepath, cavename in subcavefiles %} - {{cavename}} + {{cavename}} {% endfor %}
    FileFontSurvexBlocksSizePathsScans folderScan filesFrames
    {{tunnelfile.tunnelpath}}{{tunnelfile.tunnelpath}} {{tunnelfile.bfontcolours}} {{tunnelfile.filesize}} {% for rtunnelfile in tunnelfile.tunnelcontains.all %} - {{rtunnelfile.tunnelpath}} + {{rtunnelfile.tunnelpath}} {% endfor %}