You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So when I run this report:
class ListOfDevicesNow(ReportView):
#report_title = _("List of devices")
report_model = device_view
report_title = "List of devices"
date_field = "import_date"
filters = ["Name"]
columns = [
"Name",
"Model",
"SerialNumber",
"ConnectionState",
"OsVerTxt",
"User",
"LastBootUtc",
"LastConnUtc",
"CreatedUtc",
"id",
]
default_order_by = "-id"
limit_records = 10
Table has data in.
I get this error on server console:
Takes a list of dicts, returns that list sorted by the property given in', ' the argument.', ' """'], 'context_line': ' return sorted(value, key=lambda x: x[arg], reverse=desc)', 'post_context': ['', '', 'class ExportToCSV(object):', ' def get_filename(self):',
' return self.report_title', ''], 'pre_context_lineno': 28, 'colno': '', 'tb_area_colno': ''}}]
Internal Server Error: /list-of-devices-now/
....
grc\slick_reporting\views.py", line 35, in
return sorted(value, key=lambda x: x[arg], reverse=desc)
KeyError: 'id'
Which leads to this code:
def dictsort(value, arg, desc=False):
"""
Takes a list of dicts, returns that list sorted by the property given in
the argument.
"""
return sorted(value, key=lambda x: x[arg], reverse=desc)
Can you please give me some direction?
The text was updated successfully, but these errors were encountered:
So when I run this report:
class ListOfDevicesNow(ReportView):
#report_title = _("List of devices")
report_model = device_view
report_title = "List of devices"
date_field = "import_date"
filters = ["Name"]
columns = [
"Name",
"Model",
"SerialNumber",
"ConnectionState",
"OsVerTxt",
"User",
"LastBootUtc",
"LastConnUtc",
"CreatedUtc",
"id",
]
default_order_by = "-id"
limit_records = 10
Table has data in.
I get this error on server console:
Takes a list of dicts, returns that list sorted by the property given in', ' the argument.', ' """'], 'context_line': ' return sorted(value, key=lambda x: x[arg], reverse=desc)', 'post_context': ['', '', 'class ExportToCSV(object):', ' def get_filename(self):',
' return self.report_title', ''], 'pre_context_lineno': 28, 'colno': '', 'tb_area_colno': ''}}]
Internal Server Error: /list-of-devices-now/
....
grc\slick_reporting\views.py", line 35, in
return sorted(value, key=lambda x: x[arg], reverse=desc)
KeyError: 'id'
Which leads to this code:
def dictsort(value, arg, desc=False):
"""
Takes a list of dicts, returns that list sorted by the property given in
the argument.
"""
return sorted(value, key=lambda x: x[arg], reverse=desc)
The text was updated successfully, but these errors were encountered: