mirror of https://github.com/jumpserver/jumpserver
[Bugfix] 修改label api bug
parent
1c7212014b
commit
5f2ca58d62
|
@ -29,10 +29,6 @@ class Label(models.Model):
|
||||||
for name in names:
|
for name in names:
|
||||||
yield name, cls.objects.filter(name=name)
|
yield name, cls.objects.filter(name=name)
|
||||||
|
|
||||||
@property
|
|
||||||
def asset_count(self):
|
|
||||||
return self.assets.count()
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{}:{}".format(self.name, self.value)
|
return "{}:{}".format(self.name, self.value)
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ class LabelSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_asset_count(obj):
|
def get_asset_count(obj):
|
||||||
return obj.asset_count
|
return obj.assets.count()
|
||||||
|
|
||||||
def get_field_names(self, declared_fields, info):
|
def get_field_names(self, declared_fields, info):
|
||||||
fields = super().get_field_names(declared_fields, info)
|
fields = super().get_field_names(declared_fields, info)
|
||||||
|
|
Loading…
Reference in New Issue