Add button widget for forms

This widget will allow displaying HTML anchor buttons inside
the forms. It uses by default the navigation instance template
from the navigation app.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2018-12-18 17:21:21 -04:00
parent 76853147c8
commit 7672aca7a9
2 changed files with 12 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
{% with widget.value as link %}
{% include 'navigation/generic_link_instance.html' %}
{% endwith %}

View File

@@ -9,6 +9,15 @@ from .icons import icon_fail as default_icon_fail
from .icons import icon_ok as default_icon_ok
class ButtonWidget(forms.widgets.Widget):
template_name = 'common/forms/widgets/button_widget.html'
def format_value(self, value):
if value == '' or value is None:
return None
return value
class DisableableSelectWidget(forms.SelectMultiple):
allow_multiple_selected = True