mirror of
https://github.com/Hopiu/django-fobi.git
synced 2026-03-16 22:10:28 +00:00
29 lines
828 B
Python
29 lines
828 B
Python
from django import forms
|
|
|
|
from .forms import SampleTextareaForm
|
|
|
|
from fobi.base import FormFieldPlugin, form_element_plugin_registry
|
|
|
|
|
|
class SampleTextareaPlugin(FormFieldPlugin):
|
|
"""SampleTextareaPlugin."""
|
|
|
|
uid = "sample_textarea"
|
|
name = "Sample Textarea"
|
|
form = SampleTextareaForm
|
|
group = "Samples" # Group to which the plugin belongs to
|
|
|
|
def get_form_field_instances(
|
|
self, request=None, form_entry=None, form_element_entries=None, **kwargs
|
|
):
|
|
field_kwargs = {
|
|
"required": self.data.required,
|
|
"label": self.data.label,
|
|
"initial": self.data.initial,
|
|
"widget": forms.widgets.Textarea(attrs={}),
|
|
}
|
|
|
|
return [(self.data.name, forms.CharField, field_kwargs)]
|
|
|
|
|
|
form_element_plugin_registry.register(SampleTextareaPlugin)
|