Skip to content

Commit 7fd3fab

Browse files
committed
[fix/chores] Limit command results in device admin to 30
The previous solution didn't work.
1 parent f6c5720 commit 7fd3fab

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

openwisp_controller/connection/admin.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,20 @@ def get_queryset(self, request):
9292
return super(admin.StackedInline, self).get_queryset(request)
9393

9494

95+
class LimitedCommandResults(forms.models.BaseInlineFormSet):
96+
"""Limits results to 30"""
97+
98+
def get_queryset(self):
99+
return super().get_queryset()[0:30]
100+
101+
95102
class CommandInline(admin.StackedInline):
96103
model = Command
97104
verbose_name = _('Recent Commands')
98105
verbose_name_plural = verbose_name
99106
fields = ['status', 'type', 'input_data', 'output_data', 'created', 'modified']
100107
readonly_fields = ['input_data', 'output_data']
101-
max_num = 30
108+
formset = LimitedCommandResults
102109
# hack for openwisp-monitoring integration
103110
# TODO: remove when this issue solved:
104111
# https://github.com/theatlantic/django-nested-admin/issues/128#issuecomment-665833142

0 commit comments

Comments
 (0)