Skip to content

Commit 837823f

Browse files
committed
Make sure HTML id does't containt spaces
- Legacy-Id: 4246
1 parent ed15193 commit 837823f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

ietf/doc/admin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from django.template.defaultfilters import slugify
12
from django.utils.safestring import mark_safe
23
from django.contrib import admin
34
from django import forms
@@ -38,7 +39,7 @@ def render(self, name, value, attrs=None, choices=()):
3839
html = []
3940
first = True
4041
for label, states in categorized_choices:
41-
htmlid = "id_%s_%s" % (name, label)
42+
htmlid = "id_%s_%s" % (name, slugify(label))
4243

4344
html.append('<div style="clear:both;padding-top:%s">' % ("1em" if first else "0.5em"))
4445
html.append(u'<label for="%s">%s:</label>' % (htmlid, label))

0 commit comments

Comments
 (0)