add help text for status
This commit is contained in:
@@ -1,58 +1,65 @@
|
||||
from django import forms
|
||||
from django.forms import DateInput
|
||||
|
||||
from .models import Rental, RentalItem
|
||||
|
||||
|
||||
class DateInput(DateInput):
|
||||
input_type = "date"
|
||||
|
||||
|
||||
class RentalCreateForm(forms.ModelForm):
|
||||
# Conformation
|
||||
conformation = forms.BooleanField(
|
||||
required=True,
|
||||
label=("Ich habe die Verleihregeln gelesen und akzeptiere sie."),
|
||||
initial=False,
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = Rental
|
||||
|
||||
fields = [
|
||||
"firstname",
|
||||
"surname",
|
||||
"matriculation_number",
|
||||
"email",
|
||||
"phone",
|
||||
"organization",
|
||||
"date_start",
|
||||
"date_end",
|
||||
"reason",
|
||||
"comment",
|
||||
"rentalitems",
|
||||
]
|
||||
|
||||
widgets = {
|
||||
"date_start": DateInput(format=("%Y-%m-%d")),
|
||||
"date_end": DateInput(format=("%Y-%m-%d")),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs) # to get the self.fields set
|
||||
|
||||
self.fields["firstname"].autofocus = True
|
||||
|
||||
|
||||
class RentalAdminForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Rental
|
||||
fields = "__all__"
|
||||
|
||||
widgets = {"rentalitems": forms.CheckboxSelectMultiple()}
|
||||
|
||||
|
||||
class RentalItemAdminForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = RentalItem
|
||||
fields = "__all__"
|
||||
from django import forms
|
||||
from django.forms import DateInput
|
||||
|
||||
from .models import Rental, RentalItem
|
||||
|
||||
|
||||
class DateInput(DateInput):
|
||||
input_type = "date"
|
||||
|
||||
|
||||
class RentalCreateForm(forms.ModelForm):
|
||||
# Conformation
|
||||
conformation = forms.BooleanField(
|
||||
required=True,
|
||||
label=("Ich habe die Verleihregeln gelesen und akzeptiere sie."),
|
||||
initial=False,
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = Rental
|
||||
|
||||
fields = [
|
||||
"firstname",
|
||||
"surname",
|
||||
"matriculation_number",
|
||||
"email",
|
||||
"phone",
|
||||
"organization",
|
||||
"date_start",
|
||||
"date_end",
|
||||
"reason",
|
||||
"comment",
|
||||
"rentalitems",
|
||||
]
|
||||
|
||||
widgets = {
|
||||
"date_start": DateInput(format=("%Y-%m-%d")),
|
||||
"date_end": DateInput(format=("%Y-%m-%d")),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs) # to get the self.fields set
|
||||
|
||||
self.fields["firstname"].autofocus = True
|
||||
|
||||
|
||||
class RentalAdminForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Rental
|
||||
fields = "__all__"
|
||||
|
||||
widgets = {"rentalitems": forms.CheckboxSelectMultiple()}
|
||||
|
||||
help_texts = {
|
||||
"status": (
|
||||
"Wird der Status auf 'Verleih genehmigt' oder 'Verleih abgelehnt' gesetzt, wird "
|
||||
"eine E-Mail gesendet."
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
class RentalItemAdminForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = RentalItem
|
||||
fields = "__all__"
|
||||
|
||||
Reference in New Issue
Block a user