diff --git a/admin/templates/brands/list.html b/admin/templates/brands/list.html index fcdc512849c..5335ff923f6 100644 --- a/admin/templates/brands/list.html +++ b/admin/templates/brands/list.html @@ -17,12 +17,14 @@

List of Brands

Name + Service - {% for brand in brands %} + {% for brand in brands|dictsort:"name" %} {{ brand.name }} + {{ brand.get_provider_types }} {% endfor %} diff --git a/osf/models/brand.py b/osf/models/brand.py index 5a857f5f3b1..fc162ea3c90 100644 --- a/osf/models/brand.py +++ b/osf/models/brand.py @@ -25,5 +25,18 @@ class Meta: secondary_color = models.CharField(max_length=7) background_color = models.CharField(max_length=7, blank=True, null=True) + def get_provider_types(self): + unique_types = self.providers.values_list('type', flat=True).distinct() + results = [] + # cast osf.collectionprovider, osf.registrationprovider, osf.preprintprovider to more readable UI format + for unique_type in unique_types: + if 'registration' in unique_type: + results.append('Registry') + elif 'collection' in unique_type: + results.append('Collection') + elif 'preprint' in unique_type: + results.append('Preprint') + return ', '.join(results) + def __str__(self): return f'{self.name} ({self.id})'