4 Commits

Author SHA1 Message Date
jannik 66417ac9ff Merge remote-tracking branch 'origin/master'
Run tests / Execute tox to run the test suite (push) Successful in 4m55s
2025-05-22 14:34:03 +02:00
jannik 7dcd5a5d30 added participation conditions link 2024-12-20 16:20:41 +01:00
jannik 34eaa24e36 added senior level 2024-12-20 16:15:32 +01:00
jannik 7807dad400 added participation acceptance field 2024-12-20 15:36:13 +01:00
12 changed files with 56 additions and 23 deletions
+1 -4
View File
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import logging
import secrets
from django.apps import apps
from django.core.exceptions import ValidationError
from django.contrib import messages
@@ -83,15 +82,13 @@ class CreateAndSendPasswordView(generic.FormView):
form_class = forms.CreateAndSendPasswordForm
template_name = 'dav_auth/forms/recreate_password.html'
success_url = reverse_lazy('dav_auth:login')
password_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789#$%&@^~.,:;/_-*+!?'
password_length = 32
def form_valid(self, form):
username = form.cleaned_data.get('username')
user_model = get_user_model()
try:
user = user_model.objects.get(username=username)
random_password = ''.join(secrets.choice(self.password_chars) for i in range(self.password_length))
random_password = user_model.objects.make_random_password(length=32)
user.set_password(random_password)
user.save()
email = emails.PasswordSetEmail(user, random_password)
+2 -2
View File
@@ -1,6 +1,6 @@
import json
import os
from importlib.resources import files as resource_files
import pkg_resources
from django.conf import settings
from django.urls import re_path, include
@@ -65,7 +65,7 @@ class ModuleMeta:
def _load_from_package(self):
package_name = self._package_name
json_text = resource_files(package_name).joinpath(self._json_file).read_bytes()
json_text = pkg_resources.resource_string(package_name, self._json_file)
meta_dict = json.loads(json_text)
meta_dict['package'] = package_name
self.load_from_dict(meta_dict)
+7 -7
View File
@@ -2,7 +2,7 @@ import argparse
import os
import posix
import sys
from importlib.resources import files as resource_files
import pkg_resources
from django.core.management import execute_from_command_line
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.save()
input_file = resource_files(__package__).joinpath('django_project_config', 'additional_settings.py')
input_file = os.path.join('django_project_config', 'additional_settings.py')
output_file = os.path.join(django_base_dir, django_main_module, 'settings.py')
with open(output_file, 'ab') as f:
f.write(input_file.read_bytes())
f.write(pkg_resources.resource_string(__package__, input_file))
input_file = resource_files(__package__).joinpath('django_project_config', 'urls.py')
input_file = os.path.join('django_project_config', 'urls.py')
output_file = os.path.join(django_base_dir, django_main_module, 'urls.py')
with open(output_file, 'wb') as f:
f.write(input_file.read_bytes())
f.write(pkg_resources.resource_string(__package__, input_file))
input_file = resource_files(__package__).joinpath('django_project_config', 'settings-dav_base.py')
input_file = os.path.join('django_project_config', '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:
f.write(input_file.read_bytes())
f.write(pkg_resources.resource_string(__package__, input_file))
return posix.EX_OK
@@ -1,5 +1,5 @@
import os
from importlib.resources import files as resource_files
import pkg_resources
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
@@ -23,12 +23,12 @@ class Command(BaseCommand):
raise CommandError('Module \'{}\' is already enabled'.format(module_name))
settings_file_name = 'settings-{}.py'.format(module_name)
input_file = resource_files(module_name).joinpath('django_project_config', settings_file_name)
if input_file.is_file():
input_file = os.path.join('django_project_config', settings_file_name)
if pkg_resources.resource_exists(module_name, input_file):
output_file = os.path.join(django_base_dir, django_main_module, settings_file_name)
if not os.path.exists(output_file):
with open(output_file, 'wb') as f:
f.write(input_file.read_bytes())
f.write(pkg_resources.resource_string(module_name, input_file))
module_meta_obj = ModuleMeta(module_name)
config.modules[module_name] = module_meta_obj
+1
View File
@@ -76,6 +76,7 @@ LEVEL_CHOICES = ChoiceSet([
('beginner', _(u'Anfänger')),
('advanced', _(u'Fortgeschrittene')),
('family', _(u'Familien')),
('senior', _(u'Senioren'))
])
MEALS_CHOICES = ChoiceSet([
+4
View File
@@ -56,6 +56,10 @@ class AbstractParticipant(models.Model):
privacy_policy_accepted = models.BooleanField(default=False,
verbose_name=_('Einwilligung zur Datenspeicherung'))
participation_conditions_accepted = models.BooleanField(default=False,
verbose_name=_('Einwilligung der Teilnahmebedingungen'))
paid = models.BooleanField('Teilnehmerbeitrag bezahlt', default=False)
purge_at = models.DateTimeField()
@@ -3,8 +3,6 @@
{{ normalized_short_date }}
{% if alt_normalized_short_date %}({% trans 'Ersatztermin' %}: {{ alt_normalized_short_date }})
{% 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 }}
{% if mode == 'training' %}
{% trans 'Kursinhalte' %}:
@@ -46,5 +44,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 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_familyname %}{% trans 'Leitung' %}: {{ trainer_firstname }} {{ trainer_familyname }}
{% 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 %}
+11 -1
View File
@@ -51,7 +51,7 @@ class RegistrationForm(forms.ModelForm):
' Das finden wir gut,'
' aber bitte melde dich besser mal per E-Mail bei uns.'),
params={'max_age': max_age},
code='to_old',
code='too_old',
)
return val
@@ -79,6 +79,16 @@ class RegistrationForm(forms.ModelForm):
)
return val
def clean_participation_conditions_accepted(self):
val = self.cleaned_data.get('participation_conditions_accepted')
if not val:
raise forms.ValidationError(
ugettext('Um an dieser Veranstaltung teilnehmen zu können,'
' musst du die Teilnahmebedingungen akzeptieren.'),
code='participation_conditions_not_accepted',
)
return val
def clean(self):
super().clean()
dav_member = self.cleaned_data.get('dav_member')
+2
View File
@@ -84,6 +84,8 @@ class Registration(models.Model):
verbose_name=_('Einwilligung zur Datenspeicherung'))
purge_at = models.DateTimeField(_('Zeitpunkt der Datenlöschung'))
participation_conditions_accepted = models.BooleanField(default=False, verbose_name=_('Einwilligung der Teilnahmebedingungen'))
answered_obsolete = models.BooleanField(default=False, verbose_name=_('Durch Tourleitung beantwortet'))
def approx_age(self):
@@ -9,6 +9,7 @@
<button id="btn-filter-All" type="button" class="btn btn-xs btn-green">Alle Touren</button>
<button id="btn-filter-B" type="button" class="btn btn-xs btn-sport-B btn-white">Bergsteigen</button>
<button id="btn-filter-family" type="button" class="btn btn-xs btn-level-family btn-white">Familien</button>
<button id="btn-filter-senior" type="button" class="btn btn-xs btn-level-senior btn-white">Senioren</button>
<button id="btn-filter-K" type="button" class="btn btn-xs btn-sport-K btn-white">Klettern</button>
<button id="btn-filter-M" type="button" class="btn btn-xs btn-sport-M btn-white">Mountainbike</button>
<button id="btn-filter-S" type="button" class="btn btn-xs btn-sport-S btn-white">Ski</button>
@@ -127,7 +128,7 @@
<script type="text/javascript">
function filter_table(table, filter) {
const sport_choices = ["B", "K", "M", "S", "W"];
const level_choices = ["beginner", "advanced", "family"];
const level_choices = ["beginner", "advanced", "family", "senior"];
var choices = sport_choices.concat(level_choices);
var filter_cleaned = [];
var filter_expr;
@@ -200,6 +201,9 @@
$("#btn-filter-family").on("click", function() {
toggle_filter(table, filter, "family");
} );
$("#btn-filter-senior").on("click", function() {
toggle_filter(table, filter, "senior");
} );
$("#searchfield").on( "keyup change", function() {
table.column(0).search( this.value ).draw();
} );
@@ -182,6 +182,23 @@
Der/die Tourenleiter/in wird dir also persönlich per E-Mail zu- oder absagen.
</small></p>
</div>
{% if form.participation_conditions_accepted.errors %}
<div class="has-error">
{% endif %}
<div class="checkbox">
<label>
<input type="checkbox" name="participation_conditions_accepted" {% if form.participation_conditions_accepted.value %}checked="checked"{% endif %}>
{% trans 'Ich habe den oben erläuterten Teilnahmevorbehalt und die <a href="https://www.alpenverein-karlsruhe.de/programm/teilnahmebedingungen" target="_blank" rel="noreferrer noopener">Teilnahmebedingungen</a> gelesen und akzeptiert.' %}
</label>
</div>
{% if form.participation_conditions_accepted.errors %}
<div class="help-block">
{% for error in form.participation_conditions_accepted.errors %}
<p>{{ error }}</p>
{% endfor %}
</div>
</div>
{% endif %}
</div>
</div>
<div class="row">&nbsp;</div>
+1 -1
View File
@@ -1,5 +1,5 @@
babel
django<6
django<5.1
django-bootstrap3
django-countries
django-datetime-widget2