Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django 5.1 ja Python 3.12 #65

Merged
merged 39 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ecef920
Explicitly mark used fields in FormSet
ilesoft Nov 19, 2024
550193d
Use XHTML style boolean attribute to silence deprecation warning
ilesoft Nov 20, 2024
602efad
Upgrade Django to 1.7
ilesoft Nov 20, 2024
76da265
Document that manage.py syncdb is no longer in use
ilesoft Nov 22, 2024
133dba2
Upgrade Python to version 3.4
ilesoft Nov 21, 2024
43f8b29
Upgrade Django to 1.8
ilesoft Nov 21, 2024
a05e6cc
Add django.contrib.auth.middleware.SessionAuthenticationMiddleware
ilesoft Nov 21, 2024
c51e64f
Pass callable views to url() and declare urlpatterns as list
ilesoft Nov 21, 2024
1372bd5
Use new TEMPLATES setting to define where templates are
ilesoft Nov 21, 2024
57fb33d
Replace render_to_response with render
ilesoft Nov 21, 2024
e16b3f4
Upgrade Django to 1.9
ilesoft Nov 21, 2024
8c52126
Explicit cascade deletion behavior
ilesoft Nov 21, 2024
29a0806
include() not needed in admin site url conf
ilesoft Nov 21, 2024
c81cbc0
Upgrade Django to 1.10
ilesoft Nov 22, 2024
7b05d3c
Use new MIDDLEWARE setting
ilesoft Nov 22, 2024
53644fb
Upgrade Django to 1.11
ilesoft Nov 22, 2024
8f6a6e4
Renderer argument is required on Django 2.1
ilesoft Nov 23, 2024
ebecc55
Upgrade Django to 2.0
ilesoft Nov 23, 2024
29b973f
Remove unnecessary databas dump endpoint
ilesoft Nov 23, 2024
8c538ee
Use simplified URL routing syntax
ilesoft Nov 23, 2024
8809910
Upgrade Python to 3.7
ilesoft Nov 23, 2024
05093de
Fix regex warnings
ilesoft Nov 24, 2024
ee6bbf2
Upgrade Django to 2.1
ilesoft Nov 24, 2024
86e2d2d
Upgrade Django to 2.2
ilesoft Nov 25, 2024
63479b4
Upgrade Django to 3.0
ilesoft Nov 25, 2024
980205a
Upgrade Django 3.1
ilesoft Nov 25, 2024
12c7ecd
Replace depracated ifequal tag with if tag
ilesoft Nov 25, 2024
5454439
Upgrade Django to 3.2
ilesoft Nov 25, 2024
a8720a9
Upgrade Python to 3.10
ilesoft Nov 25, 2024
9352784
Upgrade Django to 4.0
ilesoft Nov 25, 2024
c2a3211
Do not use time zone support
ilesoft Nov 25, 2024
e3d0d1f
Upgrade Django to 4.1
ilesoft Nov 25, 2024
b986573
Use new recommended style to render forms
ilesoft Nov 26, 2024
8cd3750
Upgrade Django to 4.2
ilesoft Nov 26, 2024
4a4302d
Upgrade Python to 3.12
ilesoft Nov 26, 2024
e76de4b
Upgrade Django to 5.0
ilesoft Nov 26, 2024
f2f438d
Include referred tooltip.js sricpt to "new competition" page
ilesoft Nov 26, 2024
f9ec8b7
Remove transitional form renderer as divFormRenderer is default now
ilesoft Nov 26, 2024
635525e
Upgrade Django to 5.1
ilesoft Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
pip install 'black==24.10.0'
- name: Check formatting
run: |
black -t py33 --check .
black -t py33 --check web/**/*.py.example
black -t py312 --check .
black -t py312 --check web/**/*.py.example
unit-tests-sqlite:
runs-on: ubuntu-latest
timeout-minutes: 15
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.3
FROM python:3.12

WORKDIR /app/web

Expand All @@ -8,4 +8,4 @@ CMD ["python", "./manage.py", "runserver", "0.0.0.0:3000"]

COPY . /app/
COPY web/settings/docker.py.example /app/web/settings/docker.py
RUN pip install --trusted-host pypi.python.org -r /app/requirements.txt
RUN pip install -r /app/requirements.txt
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,22 @@ Tämän ohjelman mukana pitäisi tulla kopio GPL-lisenssistä; jos näin ei ole,

### Paikallisen kehitysympäristön pystytys


* Luo Kipalle virtuaaliympäristö jonnekkin: `python -m venv /tmp/venv`
* Ota virtuaaliympäristö käyttöön: `source /tmp/venv/bin/activate`
* Asenna riippuvuudet: `pip install -r requirements.txt`
* Luo jonnekkin väliaikainen hakemisto tietokannalle: `mkdir /tmp/tietokanta`
* Kopioi kehitystietokanta: `cp docs/initial.db /tmp/tietokanta/kipa.db`
* `cp ./web/settings/local.py.example ./web/settings/local.py`
* Muokkaa edellisessä luotuun asetustiedostoon tietokantatiedostolle polku `/db/kipa.db`
* Rakenna kontti: `docker build -t kipa_dev -f dev.Dockerfile .`
* Käynnistä kontti: `docker run -it --rm --volume ".:/app" --volume "/tmp/tietokanta:/db" -p 8000:8000 kipa_dev bash`
* Kontissa: `cd web`
* Kontissa: `python manage.py runserver 0.0.0.0:8000`
* Muokkaa edellisessä luotuun asetustiedostoon tietokantatiedostolle polku `/tmp/tietokanta/kipa.db`
ilesoft marked this conversation as resolved.
Show resolved Hide resolved
* `cd web`
* `python manage.py migrate --fake-initial --noinput`
* `python manage.py runserver`

### Yksikkötestien ajaminen

* tarvittaessa edellä kuvattu kontin rakennus ja käynnistäminen
* Kontissa: `cd web`
* Kontissa: `python manage.py test`
* `cd web`
* `python manage.py test`

### E2E-testien ajaminen

Expand All @@ -46,4 +48,4 @@ Kipaan suunniteltua kirjautumista.

### Python-koodin formatointi

Koodi noudattaa Black-autoformatterin vesion 24.10.0 mukaista tyyliä. Blackille annetaan lippu `--target-version py33`. Formatointi tarkastetaan osana CI-putkea.
Koodi noudattaa Black-autoformatterin vesion 24.10.0 mukaista tyyliä. Blackille annetaan lippu `--target-version py312`. Formatointi tarkastetaan osana CI-putkea.
7 changes: 0 additions & 7 deletions dev.Dockerfile

This file was deleted.

16 changes: 6 additions & 10 deletions docs/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ Vieraile tupa2.sf.net Imagen linkkiä varten.
### Muut käyttöjärjestelmät / itse muokattava asennus

Kipan laskenta perustuu Pythonin-ohjelmointikielellä kirjoitettuun koodiin.
Tällä hetkellä kehitysversiossa on käytössä Python 3.3.
Tällä hetkellä kehitysversiossa on käytössä Python 3.12.

Djangon versio 1.6 on testattu kehityspalvelimen kanssa toimivaksi.
Djangon versio 5.1 on testattu kehityspalvelimen kanssa toimivaksi.

Apache-asennus ei toimi kehitysversiossa.

Expand Down Expand Up @@ -922,15 +922,11 @@ Käyttää testidatana kaikkia fixtures/tests/ löytyviä XML-päätteisiä
tietokantapohjia.

```
python manage.py syncdb
python manage.py makemigrations
python manage.py migrate
```

päivittää tietokantatiedoston "tupa.db" "models.py" päivitetyn määrittelyn perustella.

VAROITUS: Mikäli tietokannan rakenne olennaisesti muuttuu, on
mahdollista ettei se enään ole yhteensopiva jo olemassa olevan tietokannan kanssa.
Näin tietokantaa voi olla vaikea enään muokata päivityksen jälkeen.
On suositeltavaa varmuuskopioida ja nollata tietokanta aina ennen päivittämistä.
Ovat komentoja, joilla saadaan päivitettyä tietokannan rakennetta, jos models.py on muuttunut.
Djangon dokumentaatio opastaa niiden käytössä.

```
python manage.py flush
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
django==1.6
south
django==5.1
#mysql-python
# git+https://github.com/PyMySQL/[email protected]#egg=MySQLdb
3 changes: 3 additions & 0 deletions web/media/kipa.css
Original file line number Diff line number Diff line change
Expand Up @@ -498,3 +498,6 @@ td.th_erotin {

.capitalize {text-transform:capitalize;}

.oneRowInlineForm {
display: flex;
}
37 changes: 22 additions & 15 deletions web/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@

# Local time zone for this installation.
TIME_ZONE = "Europe/Helsinki"
USE_TZ = False

# Language code for this installation.
LANGUAGE_CODE = "fi-FI"
LANGUAGE_CODE = "fi"

SITE_ID = 1

Expand Down Expand Up @@ -75,27 +76,31 @@
# Make this unique, and don't share it with anybody.
SECRET_KEY = "shbtq($_^om(xep=5f97k2+ntb3!cqn+)%8r#s6udzqnhj$5p6"

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
)

MIDDLEWARE_CLASSES = (
MIDDLEWARE = [
"django.middleware.common.CommonMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
)
]

ROOT_URLCONF = "urls"

TEMPLATE_DIRS = (
hakemisto + "/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.
)
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [
hakemisto + "/templates",
],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]

INSTALLED_APPS = [
"django.contrib.auth",
Expand All @@ -114,6 +119,8 @@

TEST_RUNNER = "tupa.tests.CustomTestRunner"

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"

# Should we serve the media files through Python?
SERVE_MEDIA = DEBUG

Expand Down
1 change: 1 addition & 0 deletions web/templates/tupa/base_riisuttu.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<link rel="stylesheet" type="text/css" href="/kipamedia/tabcontent.css" />
<link rel="icon" type="image/x-icon" href="/kipamedia/favicon.ico" />
{% block header %} {% endblock %}
<script type="text/javascript" language="javascript" src="/kipamedia/tooltip.js"></script>
<script type="text/javascript" src="/kipamedia/tabcontent.js">
/***********************************************
* Tab Content script v2.2- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
Expand Down
2 changes: 1 addition & 1 deletion web/templates/tupa/forms/arviointi.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<tr>
<td width=300>
<p>Käytössa: <input type="checkbox" name="{{arvio.name}}" id="{{arvio.id}}" value="abs"
{% ifequal arvio.value "abs" %}checked="checked" {% endifequal %}/></p>
{% if arvio.value == "abs" %}checked="checked" {% endif %}/></p>
<p><font color=red><b>
{{oikea.errors}}
</b></font>
Expand Down
6 changes: 3 additions & 3 deletions web/templates/tupa/forms/maksimi_suoritus.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
</b></font>
Parhaat pisteet saa:<br>
<input type="radio" id="{{parhaan_haku.id}}_1" value="min" name="{{parhaan_haku.name}}"
{% ifequal parhaan_haku.value "min" %}checked="checked" {% endifequal %}
{% if parhaan_haku.value == "min" %}checked="checked" {% endif %}
/> <label for="{{parhaan_haku.id}}_1">pienin</label><br>
<input type="radio" id="{{parhaan_haku.id}}_2" value="max" name="{{parhaan_haku.name}}"
{% ifequal parhaan_haku.value "max" %}checked="checked" {% endifequal %}
{% if parhaan_haku.value == "max" %}checked="checked" {% endif %}
/> <label for="{{parhaan_haku.id}}_2">suurin</label><br>
<input type="radio" id="{{parhaan_haku.id}}_3" value="" name="{{parhaan_haku.name}}"
{% ifequal parhaan_haku.value "" %}checked="checked" {% endifequal %}
{% if parhaan_haku.value == "" %}checked="checked" {% endif %}
/>
<label for="{{parhaan_haku.id}}_3">
{%if vapaa %} kaava:
Expand Down
20 changes: 10 additions & 10 deletions web/templates/tupa/forms/nolla_suoritus.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<legend>{%if vapaa %} Vapaa: {%else%} Kiinteä {% endif %}</legend>
<p>
<input type="radio" id="{{nollan_kerroin.id}}" value="1" name="{{nollan_kerroin.name}}"
{% ifequal nollan_kerroin.value "1" %}
{% if nollan_kerroin.value == "1" %}
checked="checked"
{% endifequal %}
{% endif %}
{% if not nollan_kerroin.value %}
checked="checked"
{% endif %} />
Expand All @@ -47,22 +47,22 @@
</b></font>

<input type="radio" id="{{nollan_kerroin.id}}" value="1.5" name="{{nollan_kerroin.name}}"
{% ifequal nollan_kerroin.value "1.5" %}checked="checked" {% endifequal %}/>
{% if nollan_kerroin.value == "1.5" %}checked="checked" {% endif %}/>
1.5 (pienin tulos saa parhaat pisteet)<br>
<input type="radio" id="{{nollan_kerroin.id}}" value="0.5" name="{{nollan_kerroin.name}}"
{% ifequal nollan_kerroin.value "0.5" %}checked="checked" {% endifequal %}/>
{% if nollan_kerroin.value == "0.5" %}checked="checked" {% endif%}/>
0.5 (suurin tulos saa parhaat pisteet)<br>
<input type="radio" id="{{nollan_kerroin.id}}" value="m" name="{{nollan_kerroin.name}}"
{% ifnotequal nollan_kerroin.value "1.5" %}
{% ifnotequal nollan_kerroin.value "0.5" %}
{% ifnotequal nollan_kerroin.value "1" %}
{% if nollan_kerroin.value != "1.5" %}
{% if nollan_kerroin.value != "0.5" %}
{% if nollan_kerroin.value != "1" %}
{% if nollan_kerroin.value %}

checked="checked"
{% endif %}
{% endifnotequal %}
{% endifnotequal %}
{% endifnotequal %}/>
{% endif %}
{% endif %}
{% endif %}/>

muu:

Expand Down
6 changes: 3 additions & 3 deletions web/templates/tupa/forms/osa_tehtava.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ <h1>{{ heading }}</h1>
<input type="radio" name="{{osatehtava.id}}" value="{{sarake.tyyppi}}"
onclick="
{% for sa in taulukko%}
{%ifequal sa.tyyppi sarake.tyyppi %}
{%if sa.tyyppi == sarake.tyyppi %}
setVisibility('{{sa.id}}','inline')
{% else %}
setVisibility('{{sa.id}}','none')
{% endifequal %}
{% endif %}
{% endfor %} "

{%ifequal sarake.tyyppi tyyppi %} checked='checked' {% endifequal %} />
{%if sarake.tyyppi == tyyppi %} checked='checked' {% endif %} />
{{sarake.otsikko}} &nbsp; &nbsp;
{% endfor %}
{% for sarake in taulukko%}
Expand Down
4 changes: 2 additions & 2 deletions web/templates/tupa/forms/puhdas_kaava.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

<select name="{{maarite.tyyppi.name}}">
<option value="piste"
{% ifequal maarite.tyyppi.value "piste" %}selected="selected"{% endifequal %}
{% if maarite.tyyppi.value == "piste" %}selected="selected"{% endif %}
>piste</option>
<option value="aika"
{% ifequal maarite.tyyppi.value "aika" %}selected="selected"{% endifequal %}
{% if maarite.tyyppi.value == "aika" %}selected="selected"{% endif %}
>aika</option>
</select>
</td>
Expand Down
4 changes: 2 additions & 2 deletions web/templates/tupa/forms/vapaa_kaava.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

<select name="{{maarite.tyyppi.name}}">
<option value="piste"
{% ifequal maarite.tyyppi.value "piste" %}selected="selected"{% endifequal %}
{% if maarite.tyyppi.value == "piste" %}selected="selected"{% endif %}
>piste</option>
<option value="aika"
{% ifequal maarite.tyyppi.value "aika" %}selected="selected"{% endifequal %}
{% if maarite.tyyppi.value == "aika" %}selected="selected"{% endif %}
>aika</option>
</select>
</td>
Expand Down
24 changes: 12 additions & 12 deletions web/templates/tupa/heijasta.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@
<td align="right" style="padding-right:10px;"><em> {{ sarake.maksimipisteet }} </em></td>
{% else %}

{% ifnotequal forloop.counter 0 %}
{% ifnotequal forloop.counter 1 %}
{% ifnotequal forloop.counter 2 %}
{% if forloop.counter != 0 %}
{% if forloop.counter != 1 %}
{% if forloop.counter != 2 %}
<td align="right" style="padding-right:10px;"><em> {{ sarake.maksimipisteet }} </em></td>
{% endifnotequal %}
{% endifnotequal %}
{% endifnotequal %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}

{%endfor %}
Expand All @@ -137,15 +137,15 @@
{% else %}
{% for sarake in rivi %}
{% comment %} ylarivi {% endcomment %}
{% ifequal forloop.counter 2 %}
{% if forloop.counter == 2 %}
{% comment %} ekasarake {% endcomment %}
<td align="right" style="padding-right:10px;"> {{ sarake.nro }}</td> <td>{{sarake.nimi}}
{%if sarake.lippukunta %}<br>{%endif%}
{{sarake.lippukunta}}
{%if sarake.piiri %}<br>{%endif%}
{{sarake.piiri}}</td>
{% else %}
{% ifequal forloop.counter 3 %}
{% if forloop.counter == 3 %}
<td align="right" style="padding-right:10px;">{{sarake}}</td>
{% comment %} muut sarakkeet {% endcomment %}
{% else %}
Expand All @@ -154,8 +154,8 @@
{{ sarake }}
{% if forloop.first %} </b> {%endif%}
</td>
{% endifequal %}
{% endifequal %}
{% endif %}
{% endif %}

{% endfor %}
{% endif %}
Expand All @@ -169,7 +169,7 @@
{% for sarake in rivi %}


{% ifequal forloop.counter 2 %}
{% if forloop.counter == 2 %}
{% comment %} ekasarake {% endcomment %}
<td align="right" style="padding-right:10px;">{{ sarake.nro }}</td> <td>{{ sarake.nimi }}
{%if sarake.lippukunta %}<br>{%endif%}
Expand All @@ -184,7 +184,7 @@
{{ sarake }}
{% if forloop.first %} </b> {%endif%}
</td>
{% endifequal %}
{% endif %}
{% endfor %}
</tr>
{%if forloop.counter|divisibleby:"5" %}
Expand Down
Loading
Loading