[Bugfix] 修复管理用户无法查看的bug

pull/1043/head
ibuler 2018-02-27 15:32:30 +08:00
parent 870b863136
commit 91863107d7
1 changed files with 3 additions and 6 deletions

View File

@ -175,15 +175,12 @@ class AdminUser(AssetUser):
return info
def get_related_assets(self):
assets = []
for cluster in self.cluster_set.all():
assets.extend(cluster.assets.all())
assets.extend(self.asset_set.all())
return list(set(assets))
assets = self.asset_set.all()
return assets
@property
def assets_amount(self):
return len(self.get_related_assets())
return self.get_related_assets().count()
class Meta:
ordering = ['name']