add slug and modify address, fill "anmeldung"

This commit is contained in:
Federico Justus Denkena 2023-10-04 21:35:26 +02:00
parent 061486f3ea
commit 3e66395e83
Signed by: f-denkena
GPG Key ID: 28F91C66EE36F382
6 changed files with 52 additions and 21 deletions

View File

@ -9,28 +9,28 @@
<div class="dc-container dc-round-small"> <div class="dc-container dc-round-small">
<form action="" style="margin:auto" class="dc-container dc-form" method="post"> <form action="" style="margin:auto" class="dc-container dc-form" method="post">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="form_type" value="reservierung"> <input type="hidden" name="form_type" value="register">
{{ reservierung_form.non_field_errors }} {{ register_form.non_field_errors }}
<div class="dc-container"> <div class="dc-container">
{{ reservierung_form.name.errors }} {{ register_form.name.errors }}
<label class="dc-half" for="{{ reservierung_form.name.id_for_label }}">Name:</label> <label class="dc-half" for="{{ register_form.name.id_for_label }}">Name:</label>
<div class="dc-half">{{ reservierung_form.name }}</div></div> <div class="dc-half">{{ register_form.name }}</div></div>
<div class="dc-container dc-padding-top"> <div class="dc-container dc-padding-top">
{{ reservierung_form.mail.errors }} {{ register_form.mail.errors }}
<label class="dc-half" for="{{ reservierung_form.mail.id_for_label }}">Mail-Adresse:</label> <label class="dc-half" for="{{ register_form.mail.id_for_label }}">Mail-Adresse:</label>
<div class="dc-half">{{reservierung_form.mail }}</div></div> <div class="dc-half">{{register_form.mail }}</div></div>
<div class="dc-container dc-padding-top"> <div class="dc-container dc-padding-top">
{{ reservierung_form.anzahl_b.errors }} {{ register_form.phone.errors }}
<label class="dc-half" for="{{ reservierung_form.anzahl_b.id_for_label }}">Anzahl Sitzplätze Böblingen (max. 7):</label> <label class="dc-half" for="{{ register_form.phone.id_for_label }}">Telefonnummer:</label>
<div class="dc-half">Reservierung nicht mehr möglich!</div></div> <div class="dc-half">{{ register_form.phone }}</div></div>
<div class="dc-container dc-padding-top"> <div class="dc-container dc-padding-top">
{{ reservierung_form.anzahl_w.errors }} {{ register_form.rate_reduced.errors }}
<label class="dc-half" for="{{ reservierung_form.anzahl_w.id_for_label }}">Anzahl Sitzplätze Wuppertal (max. 7):</label> <label class="dc-half" for="{{ register_form.rate_reduced.id_for_label }}">Anspruch auf ermäßigten Teilnahmebeitrag?</label>
<div class="dc-half">Reservierung nicht mehr möglich!</div></div> <div class="dc-half">{{ register_form.rate_reduced }}</div></div>
<div class="dc-container dc-padding-top"> <div class="dc-container dc-padding-top">
{{ reservierung_form.anzahl_l.errors }} {{ register_form.address.errors }}
<label class="dc-half" for="{{ reservierung_form.anzahl_l.id_for_label }}">Anzahl Sitzplätze Lübeck (max. 7):</label> <label class="dc-half" for="{{ register_form.address.id_for_label }}">Adresse:</label>
<div style="padding-bottom:7px" class="dc-half">{{reservierung_form.anzahl_l }}</div></div> <div style="padding-bottom:7px" class="dc-half">{{register_form.address }}</div></div>
<input style="width:100%" class="dc-padding-small dc-border-small dc-button dc-border-white" type="submit" value="Senden"> <input style="width:100%" class="dc-padding-small dc-border-small dc-button dc-border-white" type="submit" value="Senden">
</form> </form>

View File

@ -0,0 +1,24 @@
# Generated by Django 4.2.6 on 2023-10-04 19:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('website', '0002_registrant'),
]
operations = [
migrations.AddField(
model_name='registrant',
name='slug',
field=models.SlugField(default='TEST'),
preserve_default=False,
),
migrations.AlterField(
model_name='registrant',
name='address',
field=models.CharField(max_length=256),
),
]

View File

@ -41,7 +41,7 @@ class Contact(models.Model):
def __str__(self): def __str__(self):
return self.pseudonym return self.pseudonym
class ContactForm(ModelForm): class ContactForm(forms.ModelForm):
class Meta: class Meta:
model = Contact model = Contact
fields = ["pseudonym", "mail", "betreff", "nachricht"] fields = ["pseudonym", "mail", "betreff", "nachricht"]
@ -53,7 +53,7 @@ class Registrant(models.Model):
mail = models.EmailField() mail = models.EmailField()
phone = models.CharField(max_length=21) phone = models.CharField(max_length=21)
rate_reduced = models.BooleanField() rate_reduced = models.BooleanField()
address = models.TextField() address = models.CharField(max_length=256)
birthdate = models.DateField() birthdate = models.DateField()
gender = models.CharField(max_length=32, blank=False, choices=GESCHLECHTER) gender = models.CharField(max_length=32, blank=False, choices=GESCHLECHTER)
food = models.CharField(max_length=32, blank=False, choices=ERNÄHRUNG) food = models.CharField(max_length=32, blank=False, choices=ERNÄHRUNG)
@ -67,3 +67,9 @@ class Registrant(models.Model):
timestamp = models.DateTimeField(auto_now_add=True) timestamp = models.DateTimeField(auto_now_add=True)
payed = models.BooleanField() payed = models.BooleanField()
slug = models.SlugField() slug = models.SlugField()
class RegisterForm(ModelForm):
class Meta:
model = Registrant
fields = ["name","mail","phone","rate_reduced","address","birthdate","gender","food","music","cake","publish_address","publish_phone","info","message"]

View File

@ -1,6 +1,6 @@
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.db.models import Q from django.db.models import Q
from .models import Author, Category, Post, ContactForm from .models import Author, Category, Post, ContactForm, RegisterForm
from django.core.mail import send_mail from django.core.mail import send_mail
# Create your views here. # Create your views here.
@ -74,5 +74,6 @@ def impressum(request):
return render(request, 'impressum.html') return render(request, 'impressum.html')
def anmeldung(request): def anmeldung(request):
context = {} register_form = RegisterForm()
context = {"register_form": register_form}
return render(request, 'anmeldung.html', context) return render(request, 'anmeldung.html', context)