konova/intervention/inputs.py
mpeltriaux ea0a07890c #7 New forms
* introduces bootstrap class form-control for proper html form input rendering
* fixes bug where missing shared users for an entry resulted in a None exception
* adds GenerateInput with template in generate-content-input.html, which provides a generate button for fetching server-side content
* adds/updates translations
2021-09-27 13:57:56 +02:00

33 lines
885 B
Python

from django import forms
class DummyFilterInput(forms.HiddenInput):
""" A dummy input widget
Does not render anything. Can be used to keep filter logic using django_filter without having a pre defined
filter widget being rendered to the template.
"""
template_name = "konova/custom_widgets/dummy-filter-input.html"
class TextToClipboardInput(forms.TextInput):
template_name = "konova/custom_widgets/text-to-clipboard-input.html"
class GenerateInput(forms.TextInput):
"""
Provides a form group with a button at the end, which generates new content for the input.
The url used to fetch new content can be added using the attrs like
widget=GenerateInput(
attrs={
"url": reverse_lazy("app_name:view_name")
...
}
)
"""
template_name = "konova/custom_widgets/generate-content-input.html"