User forms
* 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/...
This commit is contained in:
54
user/forms/team.py
Normal file
54
user/forms/team.py
Normal file
@@ -0,0 +1,54 @@
|
||||
"""
|
||||
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"
|
||||
]
|
||||
)
|
||||
Reference in New Issue
Block a user