Update TwoStateWidget to use a template
Make it compatible with the SourceColumn class. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -3,8 +3,8 @@ from __future__ import unicode_literals
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.common.apps import MayanAppConfig
|
||||
from mayan.apps.common.html_widgets import TwoStateWidget
|
||||
from mayan.apps.common.menus import menu_object, menu_secondary, menu_tools
|
||||
from mayan.apps.common.widgets import TwoStateWidget
|
||||
from mayan.apps.navigation import SourceColumn
|
||||
|
||||
from .classes import CeleryQueue, Task
|
||||
@@ -32,16 +32,12 @@ class TaskManagerApp(MayanAppConfig):
|
||||
source=CeleryQueue, label=_('Name'), attribute='name'
|
||||
)
|
||||
SourceColumn(
|
||||
source=CeleryQueue, label=_('Default queue?'),
|
||||
func=lambda context: TwoStateWidget(
|
||||
state=context['object'].is_default_queue
|
||||
).render()
|
||||
attribute='is_default_queue', label=_('Default queue?'),
|
||||
source=CeleryQueue, widget=TwoStateWidget
|
||||
)
|
||||
SourceColumn(
|
||||
source=CeleryQueue, label=_('Is transient?'),
|
||||
func=lambda context: TwoStateWidget(
|
||||
state=context['object'].is_transient
|
||||
).render()
|
||||
attribute='is_transient', label=_('Is transient?'),
|
||||
source=CeleryQueue, widget=TwoStateWidget
|
||||
)
|
||||
SourceColumn(
|
||||
source=Task, label=_('Type'), attribute='task_type'
|
||||
@@ -53,12 +49,6 @@ class TaskManagerApp(MayanAppConfig):
|
||||
source=Task, label=_('Host'),
|
||||
func=lambda context: context['object'].kwargs['hostname']
|
||||
)
|
||||
SourceColumn(
|
||||
source=Task, label=_('Acknowledged'),
|
||||
func=lambda context: TwoStateWidget(
|
||||
state=context['object'].kwargs['acknowledged']
|
||||
).render()
|
||||
)
|
||||
SourceColumn(
|
||||
source=Task, label=_('Arguments'),
|
||||
func=lambda context: context['object'].kwargs['args']
|
||||
|
||||
Reference in New Issue
Block a user