Compare commits
4 Commits
master
..
dev-jannik
| Author | SHA1 | Date | |
|---|---|---|---|
| 66417ac9ff | |||
| 7dcd5a5d30 | |||
| 34eaa24e36 | |||
| 7807dad400 |
+1
-4
@@ -1,6 +1,5 @@
|
|||||||
# -*- 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
|
||||||
@@ -83,15 +82,13 @@ 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 = ''.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.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
|
||||||
from importlib.resources import files as resource_files
|
import pkg_resources
|
||||||
|
|
||||||
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 = 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 = 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
|
||||||
from importlib.resources import files as resource_files
|
import pkg_resources
|
||||||
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 = 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')
|
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(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')
|
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(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')
|
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(input_file.read_bytes())
|
f.write(pkg_resources.resource_string(__package__, input_file))
|
||||||
|
|
||||||
return posix.EX_OK
|
return posix.EX_OK
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
from importlib.resources import files as resource_files
|
import pkg_resources
|
||||||
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 = resource_files(module_name).joinpath('django_project_config', settings_file_name)
|
input_file = os.path.join('django_project_config', settings_file_name)
|
||||||
if input_file.is_file():
|
if pkg_resources.resource_exists(module_name, input_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(input_file.read_bytes())
|
f.write(pkg_resources.resource_string(module_name, input_file))
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ LEVEL_CHOICES = ChoiceSet([
|
|||||||
('beginner', _(u'Anfänger')),
|
('beginner', _(u'Anfänger')),
|
||||||
('advanced', _(u'Fortgeschrittene')),
|
('advanced', _(u'Fortgeschrittene')),
|
||||||
('family', _(u'Familien')),
|
('family', _(u'Familien')),
|
||||||
|
('senior', _(u'Senioren'))
|
||||||
])
|
])
|
||||||
|
|
||||||
MEALS_CHOICES = ChoiceSet([
|
MEALS_CHOICES = ChoiceSet([
|
||||||
|
|||||||
@@ -56,6 +56,10 @@ class AbstractParticipant(models.Model):
|
|||||||
privacy_policy_accepted = models.BooleanField(default=False,
|
privacy_policy_accepted = models.BooleanField(default=False,
|
||||||
verbose_name=_('Einwilligung zur Datenspeicherung'))
|
verbose_name=_('Einwilligung zur Datenspeicherung'))
|
||||||
|
|
||||||
|
participation_conditions_accepted = models.BooleanField(default=False,
|
||||||
|
verbose_name=_('Einwilligung der Teilnahmebedingungen'))
|
||||||
|
|
||||||
|
|
||||||
paid = models.BooleanField('Teilnehmerbeitrag bezahlt', default=False)
|
paid = models.BooleanField('Teilnehmerbeitrag bezahlt', default=False)
|
||||||
|
|
||||||
purge_at = models.DateTimeField()
|
purge_at = models.DateTimeField()
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
{{ 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' %}:
|
||||||
@@ -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 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 }}
|
{% 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 %}
|
{% endif %}
|
||||||
@@ -51,7 +51,7 @@ class RegistrationForm(forms.ModelForm):
|
|||||||
' Das finden wir gut,'
|
' Das finden wir gut,'
|
||||||
' aber bitte melde dich besser mal per E-Mail bei uns.'),
|
' aber bitte melde dich besser mal per E-Mail bei uns.'),
|
||||||
params={'max_age': max_age},
|
params={'max_age': max_age},
|
||||||
code='to_old',
|
code='too_old',
|
||||||
)
|
)
|
||||||
return val
|
return val
|
||||||
|
|
||||||
@@ -79,6 +79,16 @@ class RegistrationForm(forms.ModelForm):
|
|||||||
)
|
)
|
||||||
return val
|
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):
|
def clean(self):
|
||||||
super().clean()
|
super().clean()
|
||||||
dav_member = self.cleaned_data.get('dav_member')
|
dav_member = self.cleaned_data.get('dav_member')
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ class Registration(models.Model):
|
|||||||
verbose_name=_('Einwilligung zur Datenspeicherung'))
|
verbose_name=_('Einwilligung zur Datenspeicherung'))
|
||||||
purge_at = models.DateTimeField(_('Zeitpunkt der Datenlöschung'))
|
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'))
|
answered_obsolete = models.BooleanField(default=False, verbose_name=_('Durch Tourleitung beantwortet'))
|
||||||
|
|
||||||
def approx_age(self):
|
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-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-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-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-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-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>
|
<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">
|
<script type="text/javascript">
|
||||||
function filter_table(table, filter) {
|
function filter_table(table, filter) {
|
||||||
const sport_choices = ["B", "K", "M", "S", "W"];
|
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 choices = sport_choices.concat(level_choices);
|
||||||
var filter_cleaned = [];
|
var filter_cleaned = [];
|
||||||
var filter_expr;
|
var filter_expr;
|
||||||
@@ -200,6 +201,9 @@
|
|||||||
$("#btn-filter-family").on("click", function() {
|
$("#btn-filter-family").on("click", function() {
|
||||||
toggle_filter(table, filter, "family");
|
toggle_filter(table, filter, "family");
|
||||||
} );
|
} );
|
||||||
|
$("#btn-filter-senior").on("click", function() {
|
||||||
|
toggle_filter(table, filter, "senior");
|
||||||
|
} );
|
||||||
$("#searchfield").on( "keyup change", function() {
|
$("#searchfield").on( "keyup change", function() {
|
||||||
table.column(0).search( this.value ).draw();
|
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.
|
Der/die Tourenleiter/in wird dir also persönlich per E-Mail zu- oder absagen.
|
||||||
</small></p>
|
</small></p>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
<div class="row"> </div>
|
<div class="row"> </div>
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
babel
|
babel
|
||||||
django<6
|
django<5.1
|
||||||
django-bootstrap3
|
django-bootstrap3
|
||||||
django-countries
|
django-countries
|
||||||
django-datetime-widget2
|
django-datetime-widget2
|
||||||
|
|||||||
Reference in New Issue
Block a user