Skip to content

Commit f106062

Browse files
authored
[ENG-9805] implement asc sorting for admin brand tab (case insensitive) (#11591)
* implement asc sorting for admin brand tab (case insensitive) * Fix indentation in brand list template
1 parent 611c176 commit f106062

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

admin/templates/brands/list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ <h2>List of Brands</h2>
2121
</tr>
2222
</thead>
2323
<tbody>
24-
{% for brand in brands|dictsort:"name" %}
24+
{% for brand in brands|dictsort:"name_lower" %}
2525
<tr>
2626
<td><a href="{% url 'brands:detail' brand_id=brand.id %}">{{ brand.name }}</a></td>
2727
<td>{{ brand.get_provider_types }}</td>

osf/models/brand.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ class Meta:
2525
secondary_color = models.CharField(max_length=7)
2626
background_color = models.CharField(max_length=7, blank=True, null=True)
2727

28+
@property
29+
def name_lower(self):
30+
return self.name.lower() if self.name else ''
31+
2832
def get_provider_types(self):
2933
unique_types = self.providers.values_list('type', flat=True).distinct()
3034
results = []

0 commit comments

Comments
 (0)