maps: adapt icon order for accentuated labels (#21571)
This commit is contained in:
parent
19c73ccc72
commit
8ddf947e59
|
@ -17,6 +17,7 @@
|
|||
import django
|
||||
from django import forms
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.text import slugify
|
||||
|
||||
from .models import MapLayer
|
||||
|
||||
|
@ -53,7 +54,7 @@ class MapNewLayerForm(forms.ModelForm):
|
|||
def __init__(self, *args, **kwargs):
|
||||
super(MapNewLayerForm, self).__init__(*args, **kwargs)
|
||||
self.fields['icon'].choices = list(
|
||||
sorted(self.fields['icon'].choices, key=lambda x: force_text(x[1])))
|
||||
sorted(self.fields['icon'].choices, key=lambda x: slugify(force_text(x[1]))))
|
||||
|
||||
|
||||
class MapLayerForm(forms.ModelForm):
|
||||
|
@ -68,4 +69,4 @@ class MapLayerForm(forms.ModelForm):
|
|||
def __init__(self, *args, **kwargs):
|
||||
super(MapLayerForm, self).__init__(*args, **kwargs)
|
||||
self.fields['icon'].choices = list(
|
||||
sorted(self.fields['icon'].choices, key=lambda x: force_text(x[1])))
|
||||
sorted(self.fields['icon'].choices, key=lambda x: slugify(force_text(x[1]))))
|
||||
|
|
Loading…
Reference in New Issue