Skip to content

Instantly share code, notes, and snippets.

@jedie
Created May 17, 2011 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jedie/976467 to your computer and use it in GitHub Desktop.
Save jedie/976467 to your computer and use it in GitHub Desktop.
django/forms/util.py
diff --git a/django/forms/util.py b/django/forms/util.py
index 1a1d823..8a48009 100644
--- a/django/forms/util.py
+++ b/django/forms/util.py
@@ -13,7 +13,7 @@ def flatatt(attrs):
XML-style pairs. It is assumed that the keys do not need to be XML-escaped.
If the passed dictionary is empty, then return an empty string.
"""
- return u''.join([u' %s="%s"' % (k, conditional_escape(v)) for k, v in attrs.items()])
+ return u''.join([u' %s="%s"' % (k, conditional_escape(v)) for k, v in sorted(attrs.items())])
class ErrorDict(dict, StrAndUnicode):
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment