add count to labels

This commit is contained in:
Wayne Witzel III
2016-05-09 14:29:08 -04:00
parent b6f8d12119
commit afe5f5ebc0
2 changed files with 8 additions and 9 deletions

View File

@@ -1685,7 +1685,7 @@ class JobOptionsSerializer(BaseSerializer):
return res
def _summary_field_labels(self, obj):
return [{'id': x.id, 'name': x.name} for x in obj.labels.all().order_by('name')[:10]]
return {'count': obj.labels.count(), 'results': [{'id': x.id, 'name': x.name} for x in obj.labels.all().order_by('name')[:10]]}
def get_summary_fields(self, obj):
res = super(JobOptionsSerializer, self).get_summary_fields(obj)
@@ -2384,7 +2384,6 @@ class NotificationSerializer(BaseSerializer):
))
return res
class LabelSerializer(BaseSerializer):
class Meta: