mpeltriaux
05c1bf677c
* refactors user/forms.py by splitting into modals package and regular forms * regular forms can now be found at user/forms/user.py and user/forms/team.py * modal forms can now be found at user/forms/modals/...
54 lines
1.3 KiB
Python
54 lines
1.3 KiB
Python
"""
|
|
Author: Michel Peltriaux
|
|
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
|
Contact: ksp-servicestelle@sgdnord.rlp.de
|
|
Created on: 18.08.22
|
|
|
|
"""
|
|
from django import forms
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
from konova.forms.modals import BaseModalForm
|
|
|
|
|
|
class TeamDataForm(BaseModalForm):
|
|
name = forms.CharField(
|
|
label_suffix="",
|
|
label=_("Team name"),
|
|
max_length=500,
|
|
required=False,
|
|
widget=forms.TextInput(
|
|
attrs={
|
|
"placeholder": _("Team name"),
|
|
"class": "form-control",
|
|
}
|
|
)
|
|
)
|
|
description = forms.CharField(
|
|
label_suffix="",
|
|
required=False,
|
|
label=_("Description"),
|
|
widget=forms.Textarea(
|
|
attrs={
|
|
"rows": 5,
|
|
"class": "form-control"
|
|
}
|
|
)
|
|
)
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
self.form_title = _("Team")
|
|
self.form_caption = ""
|
|
self.render_submit = False
|
|
form_data = {
|
|
"name": self.instance.name,
|
|
"description": self.instance.description,
|
|
}
|
|
self.load_initial_data(
|
|
form_data,
|
|
[
|
|
"name",
|
|
"description"
|
|
]
|
|
) |