maps: sort marker alphabetically (#19065)
This commit is contained in:
parent
2c9cc327a0
commit
f18a8ccda6
|
@ -15,6 +15,8 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from django import forms
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
from .models import MapLayer
|
||||
|
||||
|
||||
|
@ -33,3 +35,8 @@ class MapLayerForm(forms.ModelForm):
|
|||
widgets = {'marker_colour': forms.TextInput(attrs={'type': 'color'}),
|
||||
'icon_colour': forms.TextInput(attrs={'type': 'color'})
|
||||
}
|
||||
|
||||
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])))
|
||||
|
|
Loading…
Reference in New Issue