Update to django 5.2 to support python 3.14 #96
+4
-1
@@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import logging
|
import logging
|
||||||
|
import secrets
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
@@ -82,13 +83,15 @@ class CreateAndSendPasswordView(generic.FormView):
|
|||||||
form_class = forms.CreateAndSendPasswordForm
|
form_class = forms.CreateAndSendPasswordForm
|
||||||
template_name = 'dav_auth/forms/recreate_password.html'
|
template_name = 'dav_auth/forms/recreate_password.html'
|
||||||
success_url = reverse_lazy('dav_auth:login')
|
success_url = reverse_lazy('dav_auth:login')
|
||||||
|
password_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789#$%&@^~.,:;/_-*+!?'
|
||||||
|
password_length = 32
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
username = form.cleaned_data.get('username')
|
username = form.cleaned_data.get('username')
|
||||||
user_model = get_user_model()
|
user_model = get_user_model()
|
||||||
try:
|
try:
|
||||||
user = user_model.objects.get(username=username)
|
user = user_model.objects.get(username=username)
|
||||||
random_password = user_model.objects.make_random_password(length=32)
|
random_password = ''.join(secrets.choice(self.password_chars) for i in range(self.password_length))
|
||||||
user.set_password(random_password)
|
user.set_password(random_password)
|
||||||
user.save()
|
user.save()
|
||||||
email = emails.PasswordSetEmail(user, random_password)
|
email = emails.PasswordSetEmail(user, random_password)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import pkg_resources
|
from importlib.resources import files as resource_files
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.urls import re_path, include
|
from django.urls import re_path, include
|
||||||
@@ -65,7 +65,7 @@ class ModuleMeta:
|
|||||||
|
|
||||||
def _load_from_package(self):
|
def _load_from_package(self):
|
||||||
package_name = self._package_name
|
package_name = self._package_name
|
||||||
json_text = pkg_resources.resource_string(package_name, self._json_file)
|
json_text = resource_files(package_name).joinpath(self._json_file).read_bytes()
|
||||||
meta_dict = json.loads(json_text)
|
meta_dict = json.loads(json_text)
|
||||||
meta_dict['package'] = package_name
|
meta_dict['package'] = package_name
|
||||||
self.load_from_dict(meta_dict)
|
self.load_from_dict(meta_dict)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import argparse
|
|||||||
import os
|
import os
|
||||||
import posix
|
import posix
|
||||||
import sys
|
import sys
|
||||||
import pkg_resources
|
from importlib.resources import files as resource_files
|
||||||
from django.core.management import execute_from_command_line
|
from django.core.management import execute_from_command_line
|
||||||
|
|
||||||
from dav_base.config.modules import DJANGO_MAIN_MODULE, ModuleConfig
|
from dav_base.config.modules import DJANGO_MAIN_MODULE, ModuleConfig
|
||||||
@@ -94,20 +94,20 @@ class AdminCommand: # pylint: disable=too-few-public-methods
|
|||||||
config = ModuleConfig(django_base_dir=django_base_dir)
|
config = ModuleConfig(django_base_dir=django_base_dir)
|
||||||
config.save()
|
config.save()
|
||||||
|
|
||||||
input_file = os.path.join('django_project_config', 'additional_settings.py')
|
input_file = resource_files(__package__).joinpath('django_project_config', 'additional_settings.py')
|
||||||
output_file = os.path.join(django_base_dir, django_main_module, 'settings.py')
|
output_file = os.path.join(django_base_dir, django_main_module, 'settings.py')
|
||||||
with open(output_file, 'ab') as f:
|
with open(output_file, 'ab') as f:
|
||||||
f.write(pkg_resources.resource_string(__package__, input_file))
|
f.write(input_file.read_bytes())
|
||||||
|
|
||||||
input_file = os.path.join('django_project_config', 'urls.py')
|
input_file = resource_files(__package__).joinpath('django_project_config', 'urls.py')
|
||||||
output_file = os.path.join(django_base_dir, django_main_module, 'urls.py')
|
output_file = os.path.join(django_base_dir, django_main_module, 'urls.py')
|
||||||
with open(output_file, 'wb') as f:
|
with open(output_file, 'wb') as f:
|
||||||
f.write(pkg_resources.resource_string(__package__, input_file))
|
f.write(input_file.read_bytes())
|
||||||
|
|
||||||
input_file = os.path.join('django_project_config', 'settings-dav_base.py')
|
input_file = resource_files(__package__).joinpath('django_project_config', 'settings-dav_base.py')
|
||||||
output_file = os.path.join(django_base_dir, django_main_module, 'settings-dav_base.py')
|
output_file = os.path.join(django_base_dir, django_main_module, 'settings-dav_base.py')
|
||||||
with open(output_file, 'wb') as f:
|
with open(output_file, 'wb') as f:
|
||||||
f.write(pkg_resources.resource_string(__package__, input_file))
|
f.write(input_file.read_bytes())
|
||||||
|
|
||||||
return posix.EX_OK
|
return posix.EX_OK
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
import pkg_resources
|
from importlib.resources import files as resource_files
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
|
|
||||||
@@ -23,12 +23,12 @@ class Command(BaseCommand):
|
|||||||
raise CommandError('Module \'{}\' is already enabled'.format(module_name))
|
raise CommandError('Module \'{}\' is already enabled'.format(module_name))
|
||||||
|
|
||||||
settings_file_name = 'settings-{}.py'.format(module_name)
|
settings_file_name = 'settings-{}.py'.format(module_name)
|
||||||
input_file = os.path.join('django_project_config', settings_file_name)
|
input_file = resource_files(module_name).joinpath('django_project_config', settings_file_name)
|
||||||
if pkg_resources.resource_exists(module_name, input_file):
|
if input_file.is_file():
|
||||||
output_file = os.path.join(django_base_dir, django_main_module, settings_file_name)
|
output_file = os.path.join(django_base_dir, django_main_module, settings_file_name)
|
||||||
if not os.path.exists(output_file):
|
if not os.path.exists(output_file):
|
||||||
with open(output_file, 'wb') as f:
|
with open(output_file, 'wb') as f:
|
||||||
f.write(pkg_resources.resource_string(module_name, input_file))
|
f.write(input_file.read_bytes())
|
||||||
|
|
||||||
module_meta_obj = ModuleMeta(module_name)
|
module_meta_obj = ModuleMeta(module_name)
|
||||||
config.modules[module_name] = module_meta_obj
|
config.modules[module_name] = module_meta_obj
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
{{ normalized_short_date }}
|
{{ normalized_short_date }}
|
||||||
{% if alt_normalized_short_date %}({% trans 'Ersatztermin' %}: {{ alt_normalized_short_date }})
|
{% if alt_normalized_short_date %}({% trans 'Ersatztermin' %}: {{ alt_normalized_short_date }})
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if trainer_email or trainer_phone %}{% if trainer_email %}{{ trainer_email }}{% endif %}{% if trainer_email and trainer_phone %}, {% endif %}{% if trainer_phone %}{{ trainer_phone }}{% endif %}
|
||||||
|
{% endif %}
|
||||||
{{ description }}
|
{{ description }}
|
||||||
{% if mode == 'training' %}
|
{% if mode == 'training' %}
|
||||||
{% trans 'Kursinhalte' %}:
|
{% trans 'Kursinhalte' %}:
|
||||||
@@ -44,5 +46,5 @@
|
|||||||
{% endif %}{% if charge > 0 or additional_costs %}{% trans 'Kosten' %}: {% if charge > 0 %}{{ charge|floatformat:'-2' }} € {% trans 'Teilnahmegebühr' %}{% endif %}{% if additional_costs %}{% if charge > 0 %} {% trans 'zzgl.' %} {% endif %}{{ additional_costs }}{% endif %}
|
{% endif %}{% if charge > 0 or additional_costs %}{% trans 'Kosten' %}: {% if charge > 0 %}{{ charge|floatformat:'-2' }} € {% trans 'Teilnahmegebühr' %}{% endif %}{% if additional_costs %}{% if charge > 0 %} {% trans 'zzgl.' %} {% endif %}{{ additional_costs }}{% endif %}
|
||||||
{% endif %}{% if registration_required and deadline %}{% trans 'Anmeldeschluss' %}: {{ deadline|date:'D, j. N Y' }}
|
{% endif %}{% if registration_required and deadline %}{% trans 'Anmeldeschluss' %}: {{ deadline|date:'D, j. N Y' }}
|
||||||
{% endif %}{% if trainer_2_fullname %}{% if mode == 'training' %}{% trans 'Ausbildungsteam' %}:{% else %}{% trans 'Team' %}:{% endif %} {{ trainer_firstname }} {{ trainer_familyname }}, {{ trainer_2_fullname }}{% if trainer_3_fullname %}, {{ trainer_3_fullname }}{% endif %}
|
{% endif %}{% if trainer_2_fullname %}{% if mode == 'training' %}{% trans 'Ausbildungsteam' %}:{% else %}{% trans 'Team' %}:{% endif %} {{ trainer_firstname }} {{ trainer_familyname }}, {{ trainer_2_fullname }}{% if trainer_3_fullname %}, {{ trainer_3_fullname }}{% endif %}
|
||||||
{% endif %}{% if trainer_familyname %}{% trans 'Leitung' %}: {{ trainer_firstname }} {{ trainer_familyname }}{% if trainer_email or trainer_phone %} ({% if trainer_email %}{{ trainer_email }}{% endif %}{% if trainer_email and trainer_phone %}, {% endif %}{% if trainer_phone %}{{ trainer_phone }}{% endif %}){% endif %}
|
{% endif %}{% if trainer_familyname %}{% trans 'Leitung' %}: {{ trainer_firstname }} {{ trainer_familyname }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
babel
|
babel
|
||||||
django<5.1
|
django<6
|
||||||
django-bootstrap3
|
django-bootstrap3
|
||||||
django-countries
|
django-countries
|
||||||
django-datetime-widget2
|
django-datetime-widget2
|
||||||
|
|||||||
Reference in New Issue
Block a user