implement abstract classes and prepare final mail
This commit is contained in:
parent
35ccfb6c14
commit
c55718f3b7
@ -7,6 +7,7 @@
|
||||
<h1 class="dc-xxlarge dc-center dc-padding">Anmeldung</h1>
|
||||
<div class="dc-container dc-padding">
|
||||
<div class="dc-container dc-round-small dc-center dc-padding dc-formula-background">
|
||||
{% if AKTIVIERT %}
|
||||
<form action="" style="margin:auto" class="dc-container dc-form" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="dc-half dc-container">
|
||||
@ -101,5 +102,8 @@
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="dc-padding">Die Anmeldung ist zur Zeit geschlossen. Bitte schaut später noch einmal vorbei.</div>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endblock content %}
|
||||
|
@ -7,7 +7,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="Tagung für junge Erwachsene">
|
||||
<link rel="stylesheet" href="{% static 'css/style.css' %}">
|
||||
<link rel="icon" href="{% static 'pictures/logo.webp' %}"
|
||||
<link rel="icon" href="{% static 'pictures/logo.webp' %}">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -6,14 +6,14 @@
|
||||
<h1 class="dc-xxlarge dc-center">Kontakt</h1>
|
||||
|
||||
<div class="dc-formula-background dc-container dc-round">
|
||||
<div class="dc-container dc-half dc-center">
|
||||
<div class="dc-container dc-center">
|
||||
<h3 class="dc-large">Tagungsbüro</h3>
|
||||
<a href="mailto:buero@im-puls.org" class="dc-medium dc-center">Mail: buero@im-puls.org<br></a>
|
||||
<p>Eine Telefonnummer des Tagungsbüros wird an alle Teilnehmer versendet.</p>
|
||||
<p>Das Tagungsbüro ist die zentrale Stelle für alle Kontaktanfragen. Sie können Sich gerne mit all Ihrer Anfragen an uns wenden. Selbstverständlich werden wir all Ihre Daten sicher und verschwiegen behandeln.</p>
|
||||
<a href="https://christengemeinschaft.de/">Träger und verantwortliche Stelle ist die Christengemeinschaft.</a>
|
||||
|
||||
</div>
|
||||
{% if False %}
|
||||
<div class="dc-container dc-half dc-padding-top">
|
||||
<h3 class="dc-large dc-center">Anonymes Kontaktformular</h3>
|
||||
<form action="" class="dc-container dc-form" method="post">
|
||||
@ -39,10 +39,10 @@
|
||||
{{ contact_form.captcha.errors }}
|
||||
<label class="dc-small dc-half" for="{{ contact_form.captcha.id_for_label }}">Captcha:</label>
|
||||
<div style="padding-bottom:7px" class="dc-half">{{contact_form.captcha }}</div></div>
|
||||
|
||||
<input style="width:100%" class="dc-dark-grey dc-padding-small" type="submit" value="Senden">
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
37
templates/final_mail.html
Normal file
37
templates/final_mail.html
Normal file
@ -0,0 +1,37 @@
|
||||
{% extends 'base_mail.html' %}
|
||||
{% load static %}
|
||||
{% block content %}
|
||||
<div class="dc-container dc-center dc-padding-24">
|
||||
<a href="https://im-puls.org"><img src="https://im-puls.org/static/pictures/logo.webp" style="width:264px;height:120px;display:grid;margin-left:auto;margin-right:auto" class="dc-padding-24"></a>
|
||||
<h2 class="dc-center">{% if form.gender == "Männlich" %}Lieber{% else %}Liebe{% endif %} {{form.name}},</h2>
|
||||
<p class="dc-center dc-large dc-padding-24">die Tagung hat nun ihr Ende gefunden. Erst einmal herzlichen Dank dafür, dass du Teil dieser Tagung mit uns warst. Nun folgt die Kontaktliste mit Teilnehmern der Tagung.<br>Falls bei einem Teilnehmer mal keine Adresse steht bedeutet dass, das der Teilnehmer eine Weitergabe seiner Daten nicht wünscht.</p>
|
||||
<div class="tg-wrap">
|
||||
<table class="tg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tg-j1i3 dc-center">Name</th>
|
||||
<th class="tg-j1i3 dc-center">Anschrift</th>
|
||||
<th class="tg-j1i3 dc-center">Mail-Adresse</th>
|
||||
<th class="tg-j1i3 dc-center">Telefonnummer</th>
|
||||
</tr>
|
||||
</thead
|
||||
<tbody>
|
||||
{% for reg in RegistrantList %}
|
||||
<tr>
|
||||
<td class="tg-0thz">{{ reg.name }}</td>
|
||||
{% if reg.publish_address %}<td class="tg-0thz">{{reg.address_street}},<br> {{reg.address_plz}} {{reg.address_town}}</td>{% else %}<td class="tg-0thz dc-center">---</td>{% endif %}
|
||||
<td class="tg-0thz">{{reg.mail}}</td>
|
||||
{% if reg.publish_phone %}<td class="tg-0thz">{{ reg.phone }}</td>{% else %}<td class="tg-0thz dc-center">---</td>{% endif %}
|
||||
</tr>
|
||||
{% empty %}
|
||||
<td class="tg-0thz" colspan="4">Leider konnten momentan keine Teilnehmer abgerufen werden.</td>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p class="dc-center dc-large dc-padding-24">Wir hoffen, dass Du viele Impulse aus der Tagung ziehen konntest.<br>Hier noch eine letzte Impuls-Vertiefung: Welche Impulse konntest du den aus der Tagung in dein Leben mitnehmen?<br>
|
||||
Mit herzlichen Grüßen,<br>
|
||||
Euer Vorbereitungsteam<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
16
templates/final_mail.txt
Normal file
16
templates/final_mail.txt
Normal file
@ -0,0 +1,16 @@
|
||||
{% if form.gender == "Männlich" %}Lieber{% else %}Liebe{% endif %} {{form.name}},
|
||||
Wir freuen uns auf auf Dich und die bevorstehende Im-Puls-Tagung. Hier noch
|
||||
eine kleine Erinnerung:
|
||||
- Schreibzeug, Hausschuhe, Eurythmieschuhe, Musikinstrumente, Schlafsack und Isomatte mitbringen.
|
||||
- Denkt an den Kuchen!
|
||||
- Das Tagungsbüro ist unter folgender Rufnummer erreichbar: 0151 70818415.
|
||||
- Die Tagung beginnt am 14. Februar um 17:00, Anreise ab 15:00.
|
||||
- Bei weiteren Fragen kannst Du gerne mit dem Tagungsbüro Kontakt aufnehmen.
|
||||
Auch gibt es schon einen kleinen Vorgeschmack auf die Arbeitsgruppen:
|
||||
- Daniel Hafner: Einführung in die Anthroposophie
|
||||
- Felicia Holland: Workshop „Kunst als Weg“
|
||||
- Ran Miller: Eurythmie
|
||||
- Martin Merckens: Spannungsfeld zwischen Licht und Finsternis
|
||||
|
||||
In Freude auf ein baldiges Treffen,
|
||||
Euer Vorbereitungsteam
|
@ -8,12 +8,12 @@
|
||||
<table class="tg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tg-jj9b">Zeit</th>
|
||||
<th class="tg-j1i3">Mittwoch</th>
|
||||
<th class="tg-j1i3">Donnerstag</th>
|
||||
<th class="tg-j1i3">Freitag</th>
|
||||
<th class="tg-j1i3">Samstag</th>
|
||||
<th class="tg-j1i3">Sonntag</th>
|
||||
<th class="tg-jj9b dc-center">Zeit</th>
|
||||
<th class="tg-j1i3 dc-center">Mittwoch</th>
|
||||
<th class="tg-j1i3 dc-center">Donnerstag</th>
|
||||
<th class="tg-j1i3 dc-center">Freitag</th>
|
||||
<th class="tg-j1i3 dc-center">Samstag</th>
|
||||
<th class="tg-j1i3 dc-center">Sonntag</th>
|
||||
</tr>
|
||||
</thead
|
||||
<colgroup>
|
||||
@ -52,12 +52,12 @@
|
||||
<td class="tg-0pky">"Ideale & Illusionen"<br>Daniel Hafner<br></td>
|
||||
<td class="tg-0pky">"Das Geistige im irdischen Goetheanismus"<br>Martin Merckens<br></td>
|
||||
<td class="tg-0pky">"Wie lerne ich zu tun, was ich will?"<br>Marco Bindelli<br></td>
|
||||
<td class="tg-7btt">11:30 - 12:30 Plenum</td>
|
||||
<td class="tg-c3ow">11:30 - 12:30 Plenum</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky">13:00</td>
|
||||
<td class="tg-7btt" colspan="3">Mittagessen</td>
|
||||
<td class="tg-7btt" rowspan="8">Hilfe beim Aufbau für die Priesterweihen</td>
|
||||
<td class="tg-c3ow" rowspan="8">Hilfe beim Aufbau für die Priesterweihen</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky">15:30</td>
|
||||
@ -88,7 +88,7 @@
|
||||
<td class="tg-7btt" colspan="4">Abendandacht</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky">---</td>
|
||||
<td class="tg-0pky">danach</td>
|
||||
<td class="tg-c3ow" colspan="4">Nachtcafe</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,15 +1,16 @@
|
||||
from django.contrib import admin
|
||||
from .models import Registrant, Author, Category, Post, Contact
|
||||
from .models import Author, Category, Post, Contact, Registrant2024, Registrant2025
|
||||
from django.core.mail import send_mail
|
||||
from django.template.loader import render_to_string
|
||||
|
||||
class RegistrantAdmin(admin.ModelAdmin):
|
||||
list_display = ('name','timestamp', 'payed', 'cake')
|
||||
#list_display = ('name','timestamp', 'payed', 'cake', 'rate_reduced')
|
||||
list_display = ('name','birthdate','address_town','mail')
|
||||
readonly_fields = ['timestamp']
|
||||
list_filter = ['payed', 'rate_reduced', 'canceled', 'team', 'food', 'cake']
|
||||
actions = ['welcome_mail','preparation_mail']
|
||||
|
||||
@admin.action(description='Send welcome mail again...')
|
||||
@admin.action(description='Send welcome mail to ...')
|
||||
def welcome_mail(self, request, queryset):
|
||||
for reg in queryset:
|
||||
msg_plain = render_to_string('welcome_mail.txt', {"form": reg})
|
||||
@ -17,17 +18,23 @@ class RegistrantAdmin(admin.ModelAdmin):
|
||||
send_mail(f'Herzlich Willkommen zur Im·Puls-Tagung, {reg.name}', msg_plain, 'buero@im-puls.org', [f"{reg.mail}"], fail_silently=False, html_message=msg_html)
|
||||
send_mail(f'Neue Anmeldung: {reg.name}', msg_plain, 'buero@im-puls.org', ["webmaster@denkena-consulting.com"], fail_silently=False, html_message=msg_html)
|
||||
|
||||
@admin.action(description='Send preparation mail...')
|
||||
@admin.action(description='Send preparation mail to ...')
|
||||
def preparation_mail(self, request, queryset):
|
||||
for reg in queryset:
|
||||
msg_plain = render_to_string('preparation_mail.txt', {"form": reg})
|
||||
msg_html = render_to_string('preparation_mail.html', {"form": reg})
|
||||
send_mail(f'Letzte Informationen zur Im·Puls-Tagung, {reg.name}', msg_plain, 'buero@im-puls.org', [f"{reg.mail}"], fail_silently=False, html_message=msg_html)
|
||||
|
||||
@admin.action(description='Send preparation mail to all')
|
||||
def preparation_mail(self):
|
||||
for reg in Registrant25.objects.all:
|
||||
msg_plain = render_to_string('preparation_mail.txt', {"form": reg})
|
||||
msg_html = render_to_string('preparation_mail.html', {"form": reg})
|
||||
send_mail(f'Letzte Informationen zur Im·Puls-Tagung, {reg.name}', msg_plain, 'buero@im-puls.org', [f"{reg.mail}"], fail_silently=False, html_message=msg_html)
|
||||
|
||||
|
||||
|
||||
admin.site.register(Registrant, RegistrantAdmin)
|
||||
admin.site.register(Author)
|
||||
admin.site.register(Category)
|
||||
admin.site.register(Post)
|
||||
admin.site.register(Contact)
|
||||
admin.site.register(Registrant2024, RegistrantAdmin)
|
||||
admin.site.register(Registrant2025, RegistrantAdmin)
|
||||
|
17
website/migrations/0017_rename_registrant_registrant2024.py
Normal file
17
website/migrations/0017_rename_registrant_registrant2024.py
Normal file
@ -0,0 +1,17 @@
|
||||
# Generated by Django 4.2.7 on 2024-02-19 13:41
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('website', '0016_registrant_team'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameModel(
|
||||
old_name='Registrant',
|
||||
new_name='Registrant2024',
|
||||
),
|
||||
]
|
42
website/migrations/0018_registrant2025.py
Normal file
42
website/migrations/0018_registrant2025.py
Normal file
@ -0,0 +1,42 @@
|
||||
# Generated by Django 4.2.7 on 2024-02-19 13:46
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('website', '0017_rename_registrant_registrant2024'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Registrant2025',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(blank=True, max_length=64)),
|
||||
('mail', models.CharField(blank=True, max_length=77)),
|
||||
('phone', models.CharField(blank=True, max_length=33)),
|
||||
('rate_reduced', models.BooleanField()),
|
||||
('address_street', models.CharField(blank=True, max_length=256)),
|
||||
('address_plz', models.CharField(blank=True, max_length=12)),
|
||||
('address_town', models.CharField(blank=True, max_length=33)),
|
||||
('birthdate', models.CharField(blank=True, max_length=33)),
|
||||
('gender', models.CharField(blank=True, choices=[('Männlich', 'Männlich'), ('Weiblich', 'Weiblich'), ('Andere', 'Andere')], max_length=33)),
|
||||
('food', models.CharField(blank=True, choices=[('Vegetarisch', 'Vegetarisch'), ('Vegan', 'Vegan'), ('Glutenfrei', 'Glutenfrei')], max_length=33)),
|
||||
('music', models.CharField(blank=True, max_length=128)),
|
||||
('cake', models.BooleanField()),
|
||||
('publish_address', models.BooleanField()),
|
||||
('publish_phone', models.BooleanField()),
|
||||
('info', models.CharField(blank=True, max_length=777)),
|
||||
('message', models.CharField(blank=True, max_length=2100)),
|
||||
('timestamp', models.DateTimeField(auto_now_add=True)),
|
||||
('payed', models.BooleanField(default=False)),
|
||||
('canceled', models.BooleanField(default=False)),
|
||||
('team', models.BooleanField(default=False)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
]
|
@ -0,0 +1,21 @@
|
||||
# Generated by Django 4.2.7 on 2024-02-19 13:48
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('website', '0018_registrant2025'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='registrant2024',
|
||||
options={'verbose_name': 'Teilnehmer 2024'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='registrant2025',
|
||||
options={'verbose_name': 'Teilnehmer 2025'},
|
||||
),
|
||||
]
|
@ -0,0 +1,21 @@
|
||||
# Generated by Django 4.2.7 on 2024-02-19 13:48
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('website', '0019_alter_registrant2024_options_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='registrant2024',
|
||||
options={'verbose_name': 'Teilnehmer 2024', 'verbose_name_plural': 'Teilnehmer 2024'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='registrant2025',
|
||||
options={'verbose_name': 'Teilnehmer 2025', 'verbose_name_plural': 'Teilnehmer 2025'},
|
||||
),
|
||||
]
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -11,9 +11,11 @@ User = get_user_model()
|
||||
class Author(models.Model):
|
||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||
def __str__(self):
|
||||
return self.user.username
|
||||
return f'{self.user.first_name} {self.user.last_name}'
|
||||
|
||||
class Category(models.Model):
|
||||
class Meta:
|
||||
verbose_name_plural = 'Categories'
|
||||
title = models.CharField(max_length=20)
|
||||
subtitle = models.CharField(max_length=20)
|
||||
slug = models.SlugField()
|
||||
@ -56,7 +58,10 @@ class ContactForm(forms.ModelForm):
|
||||
|
||||
GESCHLECHTER = [("Männlich", "Männlich"), ("Weiblich","Weiblich"),("Andere","Andere")]
|
||||
ERNÄHRUNG = [("Vegetarisch","Vegetarisch"),("Vegan","Vegan"),("Glutenfrei","Glutenfrei")]
|
||||
|
||||
class Registrant(models.Model):
|
||||
class Meta:
|
||||
abstract = True
|
||||
name = models.CharField(max_length=64,blank=True)
|
||||
mail = models.CharField(max_length=77,blank=True)
|
||||
phone = models.CharField(max_length=33,blank=True)
|
||||
@ -82,10 +87,25 @@ class Registrant(models.Model):
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class RegisterForm(ModelForm):
|
||||
captcha = CaptchaField()
|
||||
|
||||
class Registrant2024(Registrant):
|
||||
class Meta:
|
||||
model = Registrant
|
||||
fields = ["name","mail","phone","rate_reduced","address_street","address_plz","address_town","birthdate","gender","food","music","cake","publish_address","publish_phone","info","message", "captcha"]
|
||||
verbose_name = 'Teilnehmer 2024'
|
||||
verbose_name_plural = 'Teilnehmer 2024'
|
||||
|
||||
class Registrant2025(Registrant):
|
||||
class Meta:
|
||||
verbose_name = 'Teilnehmer 2025'
|
||||
verbose_name_plural = 'Teilnehmer 2025'
|
||||
|
||||
class RegisterForm(ModelForm):
|
||||
class Meta:
|
||||
abstract = True
|
||||
captcha = CaptchaField()
|
||||
gender = forms.ChoiceField(widget=forms.RadioSelect,choices=GESCHLECHTER)
|
||||
food = forms.ChoiceField(widget=forms.RadioSelect,choices=ERNÄHRUNG)
|
||||
|
||||
class RegisterForm2024(RegisterForm):
|
||||
class Meta:
|
||||
model = Registrant2024
|
||||
fields = '__all__'
|
||||
|
@ -1,6 +1,6 @@
|
||||
from django.shortcuts import render, redirect
|
||||
from django.db.models import Q
|
||||
from .models import Author, Category, Post, ContactForm, Registrant, RegisterForm
|
||||
from .models import Author, Category, Post, ContactForm, Registrant2024, RegisterForm2024
|
||||
from django.core.mail import send_mail
|
||||
from django.template.loader import render_to_string
|
||||
|
||||
@ -89,13 +89,15 @@ def failure(request):
|
||||
return render(request, 'failure.html')
|
||||
|
||||
def mail(request):
|
||||
#context = {"form": Registrant.objects.all()[6]}
|
||||
return render(request, 'welcome_mail.html',)
|
||||
#context = {"RegistrantList": filter(lambda x: not x.canceled, sorted(Registrant2024.objects.all(), key=lambda x: x.name))}
|
||||
#return render(request, 'final_mail.html', context)
|
||||
return render(request, 'final_mail.html')
|
||||
|
||||
def anmeldung(request):
|
||||
ANMELDUNG_AKTIVIERT = False
|
||||
if request.method == 'POST':
|
||||
register_form = RegisterForm(request.POST)
|
||||
if register_form.is_valid():
|
||||
register_form = RegisterForm2024(request.POST)
|
||||
if register_form.is_valid() and ANMELDUNG_AKTIVIERT:
|
||||
register_form.save()
|
||||
form = register_form.cleaned_data
|
||||
name = register_form.cleaned_data["name"]
|
||||
@ -104,14 +106,14 @@ def anmeldung(request):
|
||||
msg_html = render_to_string('welcome_mail.html', {"form": form})
|
||||
send_mail(f'Herzlich Willkommen zur Im·Puls-Tagung, {name}', msg_plain, 'buero@im-puls.org', ["xenia.medvedeva@posteo.de","buero@im-puls.org","webmaster@denkena-consulting.com"], fail_silently=False, html_message=msg_html)
|
||||
send_mail(f'Herzlich Willkommen zur Im·Puls-Tagung, {name}', msg_plain, 'buero@im-puls.org', [mail], fail_silently=False, html_message=msg_html)
|
||||
register_form = RegisterForm()
|
||||
register_form = RegisterForm2024()
|
||||
return redirect('/success/')
|
||||
else:
|
||||
return redirect('/failure/')
|
||||
try:
|
||||
if not register_form:
|
||||
register_form = RegisterForm()
|
||||
register_form = RegisterForm2024()
|
||||
except UnboundLocalError:
|
||||
register_form = RegisterForm()
|
||||
context = {"register_form": register_form}
|
||||
register_form = RegisterForm2024()
|
||||
context = {"register_form": register_form, 'AKTIVIERT': ANMELDUNG_AKTIVIERT}
|
||||
return render(request, 'anmeldung.html', context)
|
||||
|
Loading…
Reference in New Issue
Block a user