Konova code improvements
* improves rendering of codes as string (short names will be used if existing) * reduces selectable konova codes to leafs (as discussed with experts) * automatically resizes the width of modal form fields to w-100 * adds/updates translations
This commit is contained in:
@@ -155,6 +155,16 @@ class BaseModalForm(BaseForm, BSModalForm):
|
||||
render_submit = True
|
||||
template = "modal/modal_form.html"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
# Automatically add bootstrap w-100 class for maximum width of form fields in modals
|
||||
for key, val in self.fields.items():
|
||||
val.widget.attrs.update(
|
||||
{
|
||||
"class": "w-100"
|
||||
}
|
||||
)
|
||||
|
||||
def process_request(self, request: HttpRequest, msg_success: str = _("Object removed"), msg_error: str = FORM_INVALID, redirect_url: str = None):
|
||||
""" Generic processing of request
|
||||
|
||||
@@ -249,6 +259,8 @@ class RemoveModalForm(BaseModalForm):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.form_title = _("Remove")
|
||||
self.form_caption = _("Are you sure?")
|
||||
# Disable automatic w-100 setting for this type of modal form. Looks kinda strange
|
||||
self.fields["confirm"].widget.attrs["class"] = ""
|
||||
|
||||
def save(self):
|
||||
if isinstance(self.instance, BaseObject):
|
||||
|
||||
Reference in New Issue
Block a user