2021-09-27 11:45:13 +02:00
|
|
|
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.
|
|
|
|
|
|
|
|
"""
|
2021-10-06 16:15:40 +02:00
|
|
|
template_name = "konova/widgets/empty-dummy-input.html"
|
2021-09-27 11:45:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
class TextToClipboardInput(forms.TextInput):
|
2021-10-06 16:15:40 +02:00
|
|
|
template_name = "konova/widgets/text-to-clipboard-input.html"
|
2021-09-27 13:57:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
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")
|
|
|
|
...
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
"""
|
2021-10-06 16:15:40 +02:00
|
|
|
template_name = "konova/widgets/generate-content-input.html"
|