[Bugfix] 修改label api bug

pull/1007/head
ibuler 2018-01-31 18:59:43 +08:00
parent 1c7212014b
commit 5f2ca58d62
2 changed files with 1 additions and 5 deletions

View File

@ -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)

View File

@ -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)