63 lines
1.6 KiB
Python
63 lines
1.6 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 UserContactForm(BaseModalForm):
|
||
|
def save(self):
|
||
|
# Readonly form. No saving needed
|
||
|
pass
|
||
|
|
||
|
name = forms.CharField(
|
||
|
label=_("Username"),
|
||
|
label_suffix="",
|
||
|
required=False,
|
||
|
widget=forms.TextInput(
|
||
|
attrs={
|
||
|
"readonly": True,
|
||
|
"class": "form-control",
|
||
|
}
|
||
|
),
|
||
|
)
|
||
|
person_name = forms.CharField(
|
||
|
label=_("Person name"),
|
||
|
label_suffix="",
|
||
|
required=False,
|
||
|
widget=forms.TextInput(
|
||
|
attrs={
|
||
|
"readonly": True,
|
||
|
"class": "form-control",
|
||
|
}
|
||
|
),
|
||
|
)
|
||
|
mail = forms.EmailField(
|
||
|
label=_("E-Mail"),
|
||
|
label_suffix="",
|
||
|
required=False,
|
||
|
widget=forms.TextInput(
|
||
|
attrs={
|
||
|
"readonly": True,
|
||
|
"class": "form-control",
|
||
|
}
|
||
|
),
|
||
|
)
|
||
|
|
||
|
def __init__(self, *args, **kwargs):
|
||
|
super().__init__(*args, **kwargs)
|
||
|
self.render_submit = False
|
||
|
self.form_title = _("User contact data")
|
||
|
self.form_caption = ""
|
||
|
|
||
|
self.initialize_form_field("name", self.instance.username)
|
||
|
self.initialize_form_field("person_name", "{} {}".format(self.instance.first_name, self.instance.last_name))
|
||
|
self.initialize_form_field("mail", self.instance.email)
|
||
|
|