Skip to content

Commit

Permalink
Merge pull request allegro#1587 from szok/list-display
Browse files Browse the repository at this point in the history
Add __str__ to list display
  • Loading branch information
mkurek committed Jul 8, 2015
2 parents a72aff8 + 3d46a46 commit c425857
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ralph/lib/permissions/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ def get_list_display(self, request):
)
]

return list_display
return list_display or ['__str__']
13 changes: 13 additions & 0 deletions src/ralph/lib/permissions/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,16 @@ def test_get_list_display(self):
['barcode', 'sn'],
permission_admin.get_list_display(request),
)

def test_get_empty_list_display(self):
request = self.request_factory.get('/')
request.user = self.user
permission_admin = PermissionAdminMixin()

# TODO Change to test models separated from ralph
permission_admin.model = DataCenterAsset()
permission_admin.list_display = []
self.assertListEqual(
['__str__'],
permission_admin.get_list_display(request),
)

0 comments on commit c425857

Please sign in to comment.