Improve linking app column display and sorting
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -74,14 +74,23 @@ class LinkingApp(MayanAppConfig):
|
|||||||
)
|
)
|
||||||
|
|
||||||
SourceColumn(
|
SourceColumn(
|
||||||
attribute='dynamic_label', source=SmartLink
|
attribute='label', is_identifier=True, is_sortable=True,
|
||||||
|
source=SmartLink
|
||||||
)
|
)
|
||||||
SourceColumn(
|
SourceColumn(
|
||||||
attribute='enabled', source=SmartLink, widget=TwoStateWidget
|
attribute='dynamic_label', is_sortable=True, source=SmartLink
|
||||||
|
)
|
||||||
|
SourceColumn(
|
||||||
|
attribute='enabled', is_sortable=True, source=SmartLink,
|
||||||
|
widget=TwoStateWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
SourceColumn(
|
SourceColumn(
|
||||||
attribute='enabled', source=SmartLinkCondition,
|
attribute='get_full_label', is_identifier=True,
|
||||||
|
source=SmartLinkCondition
|
||||||
|
)
|
||||||
|
SourceColumn(
|
||||||
|
attribute='enabled', is_sortable=True, source=SmartLinkCondition,
|
||||||
widget=TwoStateWidget
|
widget=TwoStateWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -202,8 +202,14 @@ class SmartLinkCondition(models.Model):
|
|||||||
verbose_name_plural = _('Link conditions')
|
verbose_name_plural = _('Link conditions')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
return self.get_full_label()
|
||||||
|
|
||||||
|
def get_full_label(self):
|
||||||
return '%s foreign %s %s %s %s' % (
|
return '%s foreign %s %s %s %s' % (
|
||||||
self.get_inclusion_display(),
|
self.get_inclusion_display(),
|
||||||
self.foreign_document_data, _('not') if self.negated else '',
|
self.foreign_document_data, _('not') if self.negated else '',
|
||||||
self.get_operator_display(), self.expression
|
self.get_operator_display(), self.expression
|
||||||
)
|
)
|
||||||
|
|
||||||
|
get_full_label.short_description = _('Full label')
|
||||||
|
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ class SmartLinkListView(SingleObjectListView):
|
|||||||
def get_extra_context(self):
|
def get_extra_context(self):
|
||||||
return {
|
return {
|
||||||
'hide_link': True,
|
'hide_link': True,
|
||||||
|
'hide_object': True,
|
||||||
'no_results_icon': icon_smart_link_setup,
|
'no_results_icon': icon_smart_link_setup,
|
||||||
'no_results_main_link': link_smart_link_create.resolve(
|
'no_results_main_link': link_smart_link_create.resolve(
|
||||||
context=RequestContext(request=self.request)
|
context=RequestContext(request=self.request)
|
||||||
@@ -238,6 +239,7 @@ class SmartLinkConditionListView(SingleObjectListView):
|
|||||||
def get_extra_context(self):
|
def get_extra_context(self):
|
||||||
return {
|
return {
|
||||||
'hide_link': True,
|
'hide_link': True,
|
||||||
|
'hide_object': True,
|
||||||
'no_results_icon': icon_smart_link_condition,
|
'no_results_icon': icon_smart_link_condition,
|
||||||
'no_results_main_link': link_smart_link_condition_create.resolve(
|
'no_results_main_link': link_smart_link_condition_create.resolve(
|
||||||
context=RequestContext(
|
context=RequestContext(
|
||||||
|
|||||||
Reference in New Issue
Block a user