Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.
Thanks Vinay Sajip for the support of his django3 branch and Jannis Leidel for the review.
This commit is contained in:
parent
706fd9adc0
commit
4a103086d5
|
@ -1,434 +1,436 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
LANG_INFO = {
|
||||
'ar': {
|
||||
'bidi': True,
|
||||
'code': 'ar',
|
||||
'name': 'Arabic',
|
||||
'name_local': u'\u0627\u0644\u0639\u0631\u0628\u064a\u0651\u0629',
|
||||
'name_local': '\u0627\u0644\u0639\u0631\u0628\u064a\u0651\u0629',
|
||||
},
|
||||
'az': {
|
||||
'bidi': True,
|
||||
'code': 'az',
|
||||
'name': 'Azerbaijani',
|
||||
'name_local': u'az\u0259rbaycan dili',
|
||||
'name_local': 'az\u0259rbaycan dili',
|
||||
},
|
||||
'bg': {
|
||||
'bidi': False,
|
||||
'code': 'bg',
|
||||
'name': 'Bulgarian',
|
||||
'name_local': u'\u0431\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438',
|
||||
'name_local': '\u0431\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438',
|
||||
},
|
||||
'bn': {
|
||||
'bidi': False,
|
||||
'code': 'bn',
|
||||
'name': 'Bengali',
|
||||
'name_local': u'\u09ac\u09be\u0982\u09b2\u09be',
|
||||
'name_local': '\u09ac\u09be\u0982\u09b2\u09be',
|
||||
},
|
||||
'bs': {
|
||||
'bidi': False,
|
||||
'code': 'bs',
|
||||
'name': 'Bosnian',
|
||||
'name_local': u'bosanski',
|
||||
'name_local': 'bosanski',
|
||||
},
|
||||
'ca': {
|
||||
'bidi': False,
|
||||
'code': 'ca',
|
||||
'name': 'Catalan',
|
||||
'name_local': u'catal\xe0',
|
||||
'name_local': 'catal\xe0',
|
||||
},
|
||||
'cs': {
|
||||
'bidi': False,
|
||||
'code': 'cs',
|
||||
'name': 'Czech',
|
||||
'name_local': u'\u010desky',
|
||||
'name_local': '\u010desky',
|
||||
},
|
||||
'cy': {
|
||||
'bidi': False,
|
||||
'code': 'cy',
|
||||
'name': 'Welsh',
|
||||
'name_local': u'Cymraeg',
|
||||
'name_local': 'Cymraeg',
|
||||
},
|
||||
'da': {
|
||||
'bidi': False,
|
||||
'code': 'da',
|
||||
'name': 'Danish',
|
||||
'name_local': u'Dansk',
|
||||
'name_local': 'Dansk',
|
||||
},
|
||||
'de': {
|
||||
'bidi': False,
|
||||
'code': 'de',
|
||||
'name': 'German',
|
||||
'name_local': u'Deutsch',
|
||||
'name_local': 'Deutsch',
|
||||
},
|
||||
'el': {
|
||||
'bidi': False,
|
||||
'code': 'el',
|
||||
'name': 'Greek',
|
||||
'name_local': u'\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac',
|
||||
'name_local': '\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac',
|
||||
},
|
||||
'en': {
|
||||
'bidi': False,
|
||||
'code': 'en',
|
||||
'name': 'English',
|
||||
'name_local': u'English',
|
||||
'name_local': 'English',
|
||||
},
|
||||
'en-gb': {
|
||||
'bidi': False,
|
||||
'code': 'en-gb',
|
||||
'name': 'British English',
|
||||
'name_local': u'British English',
|
||||
'name_local': 'British English',
|
||||
},
|
||||
'eo': {
|
||||
'bidi': False,
|
||||
'code': 'eo',
|
||||
'name': 'Esperanto',
|
||||
'name_local': u'Esperanto',
|
||||
'name_local': 'Esperanto',
|
||||
},
|
||||
'es': {
|
||||
'bidi': False,
|
||||
'code': 'es',
|
||||
'name': 'Spanish',
|
||||
'name_local': u'espa\xf1ol',
|
||||
'name_local': 'espa\xf1ol',
|
||||
},
|
||||
'es-ar': {
|
||||
'bidi': False,
|
||||
'code': 'es-ar',
|
||||
'name': 'Argentinian Spanish',
|
||||
'name_local': u'espa\xf1ol de Argentina',
|
||||
'name_local': 'espa\xf1ol de Argentina',
|
||||
},
|
||||
'es-mx': {
|
||||
'bidi': False,
|
||||
'code': 'es-mx',
|
||||
'name': 'Mexican Spanish',
|
||||
'name_local': u'espa\xf1ol de Mexico',
|
||||
'name_local': 'espa\xf1ol de Mexico',
|
||||
},
|
||||
'es-ni': {
|
||||
'bidi': False,
|
||||
'code': 'es-ni',
|
||||
'name': 'Nicaraguan Spanish',
|
||||
'name_local': u'espa\xf1ol de Nicaragua',
|
||||
'name_local': 'espa\xf1ol de Nicaragua',
|
||||
},
|
||||
'et': {
|
||||
'bidi': False,
|
||||
'code': 'et',
|
||||
'name': 'Estonian',
|
||||
'name_local': u'eesti',
|
||||
'name_local': 'eesti',
|
||||
},
|
||||
'eu': {
|
||||
'bidi': False,
|
||||
'code': 'eu',
|
||||
'name': 'Basque',
|
||||
'name_local': u'Basque',
|
||||
'name_local': 'Basque',
|
||||
},
|
||||
'fa': {
|
||||
'bidi': True,
|
||||
'code': 'fa',
|
||||
'name': 'Persian',
|
||||
'name_local': u'\u0641\u0627\u0631\u0633\u06cc',
|
||||
'name_local': '\u0641\u0627\u0631\u0633\u06cc',
|
||||
},
|
||||
'fi': {
|
||||
'bidi': False,
|
||||
'code': 'fi',
|
||||
'name': 'Finnish',
|
||||
'name_local': u'suomi',
|
||||
'name_local': 'suomi',
|
||||
},
|
||||
'fr': {
|
||||
'bidi': False,
|
||||
'code': 'fr',
|
||||
'name': 'French',
|
||||
'name_local': u'Fran\xe7ais',
|
||||
'name_local': 'Fran\xe7ais',
|
||||
},
|
||||
'fy-nl': {
|
||||
'bidi': False,
|
||||
'code': 'fy-nl',
|
||||
'name': 'Frisian',
|
||||
'name_local': u'Frisian',
|
||||
'name_local': 'Frisian',
|
||||
},
|
||||
'ga': {
|
||||
'bidi': False,
|
||||
'code': 'ga',
|
||||
'name': 'Irish',
|
||||
'name_local': u'Gaeilge',
|
||||
'name_local': 'Gaeilge',
|
||||
},
|
||||
'gl': {
|
||||
'bidi': False,
|
||||
'code': 'gl',
|
||||
'name': 'Galician',
|
||||
'name_local': u'galego',
|
||||
'name_local': 'galego',
|
||||
},
|
||||
'he': {
|
||||
'bidi': True,
|
||||
'code': 'he',
|
||||
'name': 'Hebrew',
|
||||
'name_local': u'\u05e2\u05d1\u05e8\u05d9\u05ea',
|
||||
'name_local': '\u05e2\u05d1\u05e8\u05d9\u05ea',
|
||||
},
|
||||
'hi': {
|
||||
'bidi': False,
|
||||
'code': 'hi',
|
||||
'name': 'Hindi',
|
||||
'name_local': u'Hindi',
|
||||
'name_local': 'Hindi',
|
||||
},
|
||||
'hr': {
|
||||
'bidi': False,
|
||||
'code': 'hr',
|
||||
'name': 'Croatian',
|
||||
'name_local': u'Hrvatski',
|
||||
'name_local': 'Hrvatski',
|
||||
},
|
||||
'hu': {
|
||||
'bidi': False,
|
||||
'code': 'hu',
|
||||
'name': 'Hungarian',
|
||||
'name_local': u'Magyar',
|
||||
'name_local': 'Magyar',
|
||||
},
|
||||
'id': {
|
||||
'bidi': False,
|
||||
'code': 'id',
|
||||
'name': 'Indonesian',
|
||||
'name_local': u'Bahasa Indonesia',
|
||||
'name_local': 'Bahasa Indonesia',
|
||||
},
|
||||
'is': {
|
||||
'bidi': False,
|
||||
'code': 'is',
|
||||
'name': 'Icelandic',
|
||||
'name_local': u'\xcdslenska',
|
||||
'name_local': '\xcdslenska',
|
||||
},
|
||||
'it': {
|
||||
'bidi': False,
|
||||
'code': 'it',
|
||||
'name': 'Italian',
|
||||
'name_local': u'italiano',
|
||||
'name_local': 'italiano',
|
||||
},
|
||||
'ja': {
|
||||
'bidi': False,
|
||||
'code': 'ja',
|
||||
'name': 'Japanese',
|
||||
'name_local': u'\u65e5\u672c\u8a9e',
|
||||
'name_local': '\u65e5\u672c\u8a9e',
|
||||
},
|
||||
'ka': {
|
||||
'bidi': False,
|
||||
'code': 'ka',
|
||||
'name': 'Georgian',
|
||||
'name_local': u'\u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8',
|
||||
'name_local': '\u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8',
|
||||
},
|
||||
'kk': {
|
||||
'bidi': False,
|
||||
'code': 'kk',
|
||||
'name': 'Kazakh',
|
||||
'name_local': u'\u049a\u0430\u0437\u0430\u049b',
|
||||
'name_local': '\u049a\u0430\u0437\u0430\u049b',
|
||||
},
|
||||
'km': {
|
||||
'bidi': False,
|
||||
'code': 'km',
|
||||
'name': 'Khmer',
|
||||
'name_local': u'Khmer',
|
||||
'name_local': 'Khmer',
|
||||
},
|
||||
'kn': {
|
||||
'bidi': False,
|
||||
'code': 'kn',
|
||||
'name': 'Kannada',
|
||||
'name_local': u'Kannada',
|
||||
'name_local': 'Kannada',
|
||||
},
|
||||
'ko': {
|
||||
'bidi': False,
|
||||
'code': 'ko',
|
||||
'name': 'Korean',
|
||||
'name_local': u'\ud55c\uad6d\uc5b4',
|
||||
'name_local': '\ud55c\uad6d\uc5b4',
|
||||
},
|
||||
'lt': {
|
||||
'bidi': False,
|
||||
'code': 'lt',
|
||||
'name': 'Lithuanian',
|
||||
'name_local': u'Lithuanian',
|
||||
'name_local': 'Lithuanian',
|
||||
},
|
||||
'lv': {
|
||||
'bidi': False,
|
||||
'code': 'lv',
|
||||
'name': 'Latvian',
|
||||
'name_local': u'latvie\u0161u',
|
||||
'name_local': 'latvie\u0161u',
|
||||
},
|
||||
'mk': {
|
||||
'bidi': False,
|
||||
'code': 'mk',
|
||||
'name': 'Macedonian',
|
||||
'name_local': u'\u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438',
|
||||
'name_local': '\u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438',
|
||||
},
|
||||
'ml': {
|
||||
'bidi': False,
|
||||
'code': 'ml',
|
||||
'name': 'Malayalam',
|
||||
'name_local': u'Malayalam',
|
||||
'name_local': 'Malayalam',
|
||||
},
|
||||
'mn': {
|
||||
'bidi': False,
|
||||
'code': 'mn',
|
||||
'name': 'Mongolian',
|
||||
'name_local': u'Mongolian',
|
||||
'name_local': 'Mongolian',
|
||||
},
|
||||
'nb': {
|
||||
'bidi': False,
|
||||
'code': 'nb',
|
||||
'name': 'Norwegian Bokmal',
|
||||
'name_local': u'Norsk (bokm\xe5l)',
|
||||
'name_local': 'Norsk (bokm\xe5l)',
|
||||
},
|
||||
'ne': {
|
||||
'bidi': False,
|
||||
'code': 'ne',
|
||||
'name': 'Nepali',
|
||||
'name_local': u'\u0928\u0947\u092a\u093e\u0932\u0940',
|
||||
'name_local': '\u0928\u0947\u092a\u093e\u0932\u0940',
|
||||
},
|
||||
'nl': {
|
||||
'bidi': False,
|
||||
'code': 'nl',
|
||||
'name': 'Dutch',
|
||||
'name_local': u'Nederlands',
|
||||
'name_local': 'Nederlands',
|
||||
},
|
||||
'nn': {
|
||||
'bidi': False,
|
||||
'code': 'nn',
|
||||
'name': 'Norwegian Nynorsk',
|
||||
'name_local': u'Norsk (nynorsk)',
|
||||
'name_local': 'Norsk (nynorsk)',
|
||||
},
|
||||
'no': {
|
||||
'bidi': False,
|
||||
'code': 'no',
|
||||
'name': 'Norwegian',
|
||||
'name_local': u'Norsk',
|
||||
'name_local': 'Norsk',
|
||||
},
|
||||
'pa': {
|
||||
'bidi': False,
|
||||
'code': 'pa',
|
||||
'name': 'Punjabi',
|
||||
'name_local': u'Punjabi',
|
||||
'name_local': 'Punjabi',
|
||||
},
|
||||
'pl': {
|
||||
'bidi': False,
|
||||
'code': 'pl',
|
||||
'name': 'Polish',
|
||||
'name_local': u'polski',
|
||||
'name_local': 'polski',
|
||||
},
|
||||
'pt': {
|
||||
'bidi': False,
|
||||
'code': 'pt',
|
||||
'name': 'Portuguese',
|
||||
'name_local': u'Portugu\xeas',
|
||||
'name_local': 'Portugu\xeas',
|
||||
},
|
||||
'pt-br': {
|
||||
'bidi': False,
|
||||
'code': 'pt-br',
|
||||
'name': 'Brazilian Portuguese',
|
||||
'name_local': u'Portugu\xeas Brasileiro',
|
||||
'name_local': 'Portugu\xeas Brasileiro',
|
||||
},
|
||||
'ro': {
|
||||
'bidi': False,
|
||||
'code': 'ro',
|
||||
'name': 'Romanian',
|
||||
'name_local': u'Rom\xe2n\u0103',
|
||||
'name_local': 'Rom\xe2n\u0103',
|
||||
},
|
||||
'ru': {
|
||||
'bidi': False,
|
||||
'code': 'ru',
|
||||
'name': 'Russian',
|
||||
'name_local': u'\u0420\u0443\u0441\u0441\u043a\u0438\u0439',
|
||||
'name_local': '\u0420\u0443\u0441\u0441\u043a\u0438\u0439',
|
||||
},
|
||||
'sk': {
|
||||
'bidi': False,
|
||||
'code': 'sk',
|
||||
'name': 'Slovak',
|
||||
'name_local': u'slovensk\xfd',
|
||||
'name_local': 'slovensk\xfd',
|
||||
},
|
||||
'sl': {
|
||||
'bidi': False,
|
||||
'code': 'sl',
|
||||
'name': 'Slovenian',
|
||||
'name_local': u'Sloven\u0161\u010dina',
|
||||
'name_local': 'Sloven\u0161\u010dina',
|
||||
},
|
||||
'sq': {
|
||||
'bidi': False,
|
||||
'code': 'sq',
|
||||
'name': 'Albanian',
|
||||
'name_local': u'Albanian',
|
||||
'name_local': 'Albanian',
|
||||
},
|
||||
'sr': {
|
||||
'bidi': False,
|
||||
'code': 'sr',
|
||||
'name': 'Serbian',
|
||||
'name_local': u'\u0441\u0440\u043f\u0441\u043a\u0438',
|
||||
'name_local': '\u0441\u0440\u043f\u0441\u043a\u0438',
|
||||
},
|
||||
'sr-latn': {
|
||||
'bidi': False,
|
||||
'code': 'sr-latn',
|
||||
'name': 'Serbian Latin',
|
||||
'name_local': u'srpski (latinica)',
|
||||
'name_local': 'srpski (latinica)',
|
||||
},
|
||||
'sv': {
|
||||
'bidi': False,
|
||||
'code': 'sv',
|
||||
'name': 'Swedish',
|
||||
'name_local': u'Svenska',
|
||||
'name_local': 'Svenska',
|
||||
},
|
||||
'sw': {
|
||||
'bidi': False,
|
||||
'code': 'sw',
|
||||
'name': 'Swahili',
|
||||
'name_local': u'Kiswahili',
|
||||
'name_local': 'Kiswahili',
|
||||
},
|
||||
'ta': {
|
||||
'bidi': False,
|
||||
'code': 'ta',
|
||||
'name': 'Tamil',
|
||||
'name_local': u'\u0ba4\u0bae\u0bbf\u0bb4\u0bcd',
|
||||
'name_local': '\u0ba4\u0bae\u0bbf\u0bb4\u0bcd',
|
||||
},
|
||||
'te': {
|
||||
'bidi': False,
|
||||
'code': 'te',
|
||||
'name': 'Telugu',
|
||||
'name_local': u'\u0c24\u0c46\u0c32\u0c41\u0c17\u0c41',
|
||||
'name_local': '\u0c24\u0c46\u0c32\u0c41\u0c17\u0c41',
|
||||
},
|
||||
'th': {
|
||||
'bidi': False,
|
||||
'code': 'th',
|
||||
'name': 'Thai',
|
||||
'name_local': u'Thai',
|
||||
'name_local': 'Thai',
|
||||
},
|
||||
'tr': {
|
||||
'bidi': False,
|
||||
'code': 'tr',
|
||||
'name': 'Turkish',
|
||||
'name_local': u'T\xfcrk\xe7e',
|
||||
'name_local': 'T\xfcrk\xe7e',
|
||||
},
|
||||
'tt': {
|
||||
'bidi': False,
|
||||
'code': 'tt',
|
||||
'name': 'Tatar',
|
||||
'name_local': u'\u0422\u0430\u0442\u0430\u0440\u0447\u0430',
|
||||
'name_local': '\u0422\u0430\u0442\u0430\u0440\u0447\u0430',
|
||||
},
|
||||
'uk': {
|
||||
'bidi': False,
|
||||
'code': 'uk',
|
||||
'name': 'Ukrainian',
|
||||
'name_local': u'\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430',
|
||||
'name_local': '\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430',
|
||||
},
|
||||
'ur': {
|
||||
'bidi': False,
|
||||
'code': 'ur',
|
||||
'name': 'Urdu',
|
||||
'name_local': u'\u0627\u0631\u062f\u0648',
|
||||
'name_local': '\u0627\u0631\u062f\u0648',
|
||||
},
|
||||
'vi': {
|
||||
'bidi': False,
|
||||
'code': 'vi',
|
||||
'name': 'Vietnamese',
|
||||
'name_local': u'Vietnamese',
|
||||
'name_local': 'Vietnamese',
|
||||
},
|
||||
'zh-cn': {
|
||||
'bidi': False,
|
||||
'code': 'zh-cn',
|
||||
'name': 'Simplified Chinese',
|
||||
'name_local': u'\u7b80\u4f53\u4e2d\u6587',
|
||||
'name_local': '\u7b80\u4f53\u4e2d\u6587',
|
||||
},
|
||||
'zh-tw': {
|
||||
'bidi': False,
|
||||
'code': 'zh-tw',
|
||||
'name': 'Traditional Chinese',
|
||||
'name_local': u'\u7e41\u9ad4\u4e2d\u6587',
|
||||
'name_local': '\u7e41\u9ad4\u4e2d\u6587',
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
@ -19,5 +20,5 @@ SHORT_DATE_FORMAT = 'd.m.Y'
|
|||
# TIME_INPUT_FORMATS =
|
||||
# DATETIME_INPUT_FORMATS =
|
||||
DECIMAL_SEPARATOR = ','
|
||||
THOUSAND_SEPARATOR = u' ' # Non-breaking space
|
||||
THOUSAND_SEPARATOR = ' ' # Non-breaking space
|
||||
# NUMBER_GROUPING =
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
@ -33,5 +34,5 @@ DATETIME_INPUT_FORMATS = (
|
|||
'%Y-%m-%d', # '2006-10-25'
|
||||
)
|
||||
DECIMAL_SEPARATOR = ','
|
||||
THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
|
||||
THOUSAND_SEPARATOR = '\xa0' # non-breaking space
|
||||
NUMBER_GROUPING = 3
|
||||
|
|
|
@ -37,7 +37,7 @@ DATETIME_INPUT_FORMATS = (
|
|||
'%m/%d/%y %H:%M', # '10/25/06 14:30'
|
||||
'%m/%d/%y', # '10/25/06'
|
||||
)
|
||||
DECIMAL_SEPARATOR = u'.'
|
||||
THOUSAND_SEPARATOR = u','
|
||||
DECIMAL_SEPARATOR = '.'
|
||||
THOUSAND_SEPARATOR = ','
|
||||
NUMBER_GROUPING = 3
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
DATE_FORMAT = r'j \d\e F \d\e Y'
|
||||
TIME_FORMAT = 'H:i:s'
|
||||
|
@ -24,5 +25,5 @@ DATETIME_INPUT_FORMATS = (
|
|||
'%d/%m/%y %H:%M',
|
||||
)
|
||||
DECIMAL_SEPARATOR = '.' # ',' is also official (less common): NOM-008-SCFI-2002
|
||||
THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
|
||||
THOUSAND_SEPARATOR = '\xa0' # non-breaking space
|
||||
NUMBER_GROUPING = 3
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
@ -19,5 +20,5 @@ SHORT_DATE_FORMAT = 'd.m.Y'
|
|||
# TIME_INPUT_FORMATS =
|
||||
# DATETIME_INPUT_FORMATS =
|
||||
DECIMAL_SEPARATOR = ','
|
||||
THOUSAND_SEPARATOR = u' ' # Non-breaking space
|
||||
THOUSAND_SEPARATOR = ' ' # Non-breaking space
|
||||
# NUMBER_GROUPING =
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
@ -19,5 +20,5 @@ SHORT_DATE_FORMAT = 'j.n.Y'
|
|||
# TIME_INPUT_FORMATS =
|
||||
# DATETIME_INPUT_FORMATS =
|
||||
DECIMAL_SEPARATOR = ','
|
||||
THOUSAND_SEPARATOR = u' ' # Non-breaking space
|
||||
THOUSAND_SEPARATOR = ' ' # Non-breaking space
|
||||
# NUMBER_GROUPING =
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
@ -37,5 +38,5 @@ DATETIME_INPUT_FORMATS = (
|
|||
'%Y-%m-%d', # '2006-10-25'
|
||||
)
|
||||
DECIMAL_SEPARATOR = ','
|
||||
THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
|
||||
THOUSAND_SEPARATOR = '\xa0' # non-breaking space
|
||||
NUMBER_GROUPING = 3
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
@ -28,5 +29,5 @@ DATETIME_INPUT_FORMATS = (
|
|||
'%Y.%m.%d.', # '2006.10.25.'
|
||||
)
|
||||
DECIMAL_SEPARATOR = ','
|
||||
THOUSAND_SEPARATOR = u' ' # Non-breaking space
|
||||
THOUSAND_SEPARATOR = ' ' # Non-breaking space
|
||||
NUMBER_GROUPING = 3
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
@ -37,5 +38,5 @@ DATETIME_INPUT_FORMATS = (
|
|||
'%d.%m.%y', # '25.10.06'
|
||||
)
|
||||
DECIMAL_SEPARATOR = ','
|
||||
THOUSAND_SEPARATOR = u' ' # Non-breaking space
|
||||
THOUSAND_SEPARATOR = ' ' # Non-breaking space
|
||||
NUMBER_GROUPING = 3
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
@ -39,5 +40,5 @@ DATETIME_INPUT_FORMATS = (
|
|||
'%d.%m.%y', # '25.10.06'
|
||||
)
|
||||
DECIMAL_SEPARATOR = ','
|
||||
THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
|
||||
THOUSAND_SEPARATOR = '\xa0' # non-breaking space
|
||||
NUMBER_GROUPING = 3
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
@ -39,5 +40,5 @@ DATETIME_INPUT_FORMATS = (
|
|||
'%d.%m.%y', # '25.10.06'
|
||||
)
|
||||
DECIMAL_SEPARATOR = ','
|
||||
THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
|
||||
THOUSAND_SEPARATOR = '\xa0' # non-breaking space
|
||||
NUMBER_GROUPING = 3
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
@ -33,5 +34,5 @@ DATETIME_INPUT_FORMATS = (
|
|||
'%Y-%m-%d', # '2006-10-25'
|
||||
)
|
||||
DECIMAL_SEPARATOR = ','
|
||||
THOUSAND_SEPARATOR = u' '
|
||||
THOUSAND_SEPARATOR = ' '
|
||||
NUMBER_GROUPING = 3
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
@ -36,5 +37,5 @@ DATETIME_INPUT_FORMATS = (
|
|||
'%Y-%m-%d', # '2006-10-25'
|
||||
)
|
||||
DECIMAL_SEPARATOR = ','
|
||||
THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
|
||||
THOUSAND_SEPARATOR = '\xa0' # non-breaking space
|
||||
NUMBER_GROUPING = 3
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
@ -33,5 +34,5 @@ DATETIME_INPUT_FORMATS = (
|
|||
'%Y-%m-%d', # '2006-10-25'
|
||||
)
|
||||
DECIMAL_SEPARATOR = ','
|
||||
THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
|
||||
THOUSAND_SEPARATOR = '\xa0' # non-breaking space
|
||||
NUMBER_GROUPING = 3
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
@ -36,5 +37,5 @@ DATETIME_INPUT_FORMATS = (
|
|||
'%m/%d/%y', # '10/25/06'
|
||||
)
|
||||
DECIMAL_SEPARATOR = ','
|
||||
THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
|
||||
THOUSAND_SEPARATOR = '\xa0' # non-breaking space
|
||||
NUMBER_GROUPING = 3
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
DATE_FORMAT = 'j E Y р.'
|
||||
|
@ -19,5 +21,5 @@ SHORT_DATE_FORMAT = 'j M Y'
|
|||
# TIME_INPUT_FORMATS =
|
||||
# DATETIME_INPUT_FORMATS =
|
||||
DECIMAL_SEPARATOR = ','
|
||||
THOUSAND_SEPARATOR = u' '
|
||||
THOUSAND_SEPARATOR = ' '
|
||||
# NUMBER_GROUPING =
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# This file is distributed under the same license as the Django package.
|
||||
#
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django import forms
|
||||
|
||||
from django.contrib.auth import authenticate
|
||||
from django.contrib.auth.forms import AuthenticationForm
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from django.utils.translation import ugettext_lazy, ugettext as _
|
||||
|
||||
ERROR_MESSAGE = ugettext_lazy("Please enter the correct username and password "
|
||||
|
@ -25,7 +26,7 @@ class AdminAuthenticationForm(AuthenticationForm):
|
|||
if username and password:
|
||||
self.user_cache = authenticate(username=username, password=password)
|
||||
if self.user_cache is None:
|
||||
if u'@' in username:
|
||||
if '@' in username:
|
||||
# Mistakenly entered e-mail address instead of username? Look it up.
|
||||
try:
|
||||
user = User.objects.get(email=username)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django import forms
|
||||
from django.contrib.admin.util import (flatten_fieldsets, lookup_field,
|
||||
display_for_field, label_for_field, help_text_for_field)
|
||||
|
@ -69,7 +71,7 @@ class Fieldset(object):
|
|||
description=None, model_admin=None):
|
||||
self.form = form
|
||||
self.name, self.fields = name, fields
|
||||
self.classes = u' '.join(classes)
|
||||
self.classes = ' '.join(classes)
|
||||
self.description = description
|
||||
self.model_admin = model_admin
|
||||
self.readonly_fields = readonly_fields
|
||||
|
@ -109,7 +111,7 @@ class Fieldline(object):
|
|||
yield AdminField(self.form, field, is_first=(i == 0))
|
||||
|
||||
def errors(self):
|
||||
return mark_safe(u'\n'.join([self.form[f].errors.as_ul() for f in self.fields if f not in self.readonly_fields]).strip('\n'))
|
||||
return mark_safe('\n'.join([self.form[f].errors.as_ul() for f in self.fields if f not in self.readonly_fields]).strip('\n'))
|
||||
|
||||
class AdminField(object):
|
||||
def __init__(self, form, field, is_first):
|
||||
|
@ -121,14 +123,14 @@ class AdminField(object):
|
|||
classes = []
|
||||
contents = conditional_escape(force_unicode(self.field.label))
|
||||
if self.is_checkbox:
|
||||
classes.append(u'vCheckboxLabel')
|
||||
classes.append('vCheckboxLabel')
|
||||
else:
|
||||
contents += u':'
|
||||
contents += ':'
|
||||
if self.field.field.required:
|
||||
classes.append(u'required')
|
||||
classes.append('required')
|
||||
if not self.is_first:
|
||||
classes.append(u'inline')
|
||||
attrs = classes and {'class': u' '.join(classes)} or {}
|
||||
classes.append('inline')
|
||||
attrs = classes and {'class': ' '.join(classes)} or {}
|
||||
return self.field.label_tag(contents=mark_safe(contents), attrs=attrs)
|
||||
|
||||
def errors(self):
|
||||
|
@ -161,7 +163,7 @@ class AdminReadonlyField(object):
|
|||
if not self.is_first:
|
||||
attrs["class"] = "inline"
|
||||
label = self.field['label']
|
||||
contents = capfirst(force_unicode(escape(label))) + u":"
|
||||
contents = capfirst(force_unicode(escape(label))) + ":"
|
||||
return mark_safe('<label%(attrs)s>%(contents)s</label>' % {
|
||||
"attrs": flatatt(attrs),
|
||||
"contents": contents,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.auth.models import User
|
||||
|
@ -64,5 +66,5 @@ class LogEntry(models.Model):
|
|||
This is relative to the Django admin index page.
|
||||
"""
|
||||
if self.content_type and self.object_id:
|
||||
return mark_safe(u"%s/%s/%s/" % (self.content_type.app_label, self.content_type.model, quote(self.object_id)))
|
||||
return mark_safe("%s/%s/%s/" % (self.content_type.app_label, self.content_type.model, quote(self.object_id)))
|
||||
return None
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import datetime
|
||||
|
||||
from django.contrib.admin.util import (lookup_field, display_for_field,
|
||||
|
@ -27,11 +29,11 @@ def paginator_number(cl,i):
|
|||
Generates an individual page index link in a paginated list.
|
||||
"""
|
||||
if i == DOT:
|
||||
return u'... '
|
||||
return '... '
|
||||
elif i == cl.page_num:
|
||||
return mark_safe(u'<span class="this-page">%d</span> ' % (i+1))
|
||||
return mark_safe('<span class="this-page">%d</span> ' % (i+1))
|
||||
else:
|
||||
return mark_safe(u'<a href="%s"%s>%d</a> ' % (escape(cl.get_query_string({PAGE_VAR: i})), (i == cl.paginator.num_pages-1 and ' class="end"' or ''), i+1))
|
||||
return mark_safe('<a href="%s"%s>%d</a> ' % (escape(cl.get_query_string({PAGE_VAR: i})), (i == cl.paginator.num_pages-1 and ' class="end"' or ''), i+1))
|
||||
|
||||
@register.inclusion_tag('admin/pagination.html')
|
||||
def pagination(cl):
|
||||
|
@ -163,7 +165,7 @@ def result_headers(cl):
|
|||
def _boolean_icon(field_val):
|
||||
icon_url = static('admin/img/icon-%s.gif' %
|
||||
{True: 'yes', False: 'no', None: 'unknown'}[field_val])
|
||||
return mark_safe(u'<img src="%s" alt="%s" />' % (icon_url, field_val))
|
||||
return mark_safe('<img src="%s" alt="%s" />' % (icon_url, field_val))
|
||||
|
||||
def items_for_result(cl, result, form):
|
||||
"""
|
||||
|
@ -179,7 +181,7 @@ def items_for_result(cl, result, form):
|
|||
result_repr = EMPTY_CHANGELIST_VALUE
|
||||
else:
|
||||
if f is None:
|
||||
if field_name == u'action_checkbox':
|
||||
if field_name == 'action_checkbox':
|
||||
row_class = ' class="action-checkbox"'
|
||||
allow_tags = getattr(attr, 'allow_tags', False)
|
||||
boolean = getattr(attr, 'boolean', False)
|
||||
|
@ -220,7 +222,7 @@ def items_for_result(cl, result, form):
|
|||
attr = pk
|
||||
value = result.serializable_value(attr)
|
||||
result_id = repr(force_unicode(value))[1:]
|
||||
yield mark_safe(u'<%s%s><a href="%s"%s>%s</a></%s>' % \
|
||||
yield mark_safe('<%s%s><a href="%s"%s>%s</a></%s>' % \
|
||||
(table_tag, row_class, url, (cl.is_popup and ' onclick="opener.dismissRelatedLookupPopup(window, %s); return false;"' % result_id or ''), conditional_escape(result_repr), table_tag))
|
||||
else:
|
||||
# By default the fields come from ModelAdmin.list_editable, but if we pull
|
||||
|
@ -233,9 +235,9 @@ def items_for_result(cl, result, form):
|
|||
result_repr = mark_safe(force_unicode(bf.errors) + force_unicode(bf))
|
||||
else:
|
||||
result_repr = conditional_escape(result_repr)
|
||||
yield mark_safe(u'<td%s>%s</td>' % (row_class, result_repr))
|
||||
yield mark_safe('<td%s>%s</td>' % (row_class, result_repr))
|
||||
if form and not form[cl.model._meta.pk.name].is_hidden:
|
||||
yield mark_safe(u'<td>%s</td>' % force_unicode(form[cl.model._meta.pk.name]))
|
||||
yield mark_safe('<td>%s</td>' % force_unicode(form[cl.model._meta.pk.name]))
|
||||
|
||||
class ResultList(list):
|
||||
# Wrapper class used to return items in a list_editable
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import datetime
|
||||
import decimal
|
||||
|
||||
|
@ -122,14 +124,14 @@ def get_deleted_objects(objs, opts, user, admin_site, using):
|
|||
if not user.has_perm(p):
|
||||
perms_needed.add(opts.verbose_name)
|
||||
# Display a link to the admin page.
|
||||
return mark_safe(u'%s: <a href="%s">%s</a>' %
|
||||
return mark_safe('%s: <a href="%s">%s</a>' %
|
||||
(escape(capfirst(opts.verbose_name)),
|
||||
admin_url,
|
||||
escape(obj)))
|
||||
else:
|
||||
# Don't display link to edit, because it either has no
|
||||
# admin or is edited inline.
|
||||
return u'%s: %s' % (capfirst(opts.verbose_name),
|
||||
return '%s: %s' % (capfirst(opts.verbose_name),
|
||||
force_unicode(obj))
|
||||
|
||||
to_delete = collector.nested(format_callback)
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
"""
|
||||
Form Widget classes specific to the Django admin site.
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import copy
|
||||
|
||||
from django import forms
|
||||
from django.contrib.admin.templatetags.admin_static import static
|
||||
from django.core.urlresolvers import reverse
|
||||
|
@ -39,12 +41,12 @@ class FilteredSelectMultiple(forms.SelectMultiple):
|
|||
if self.is_stacked:
|
||||
attrs['class'] += 'stacked'
|
||||
output = [super(FilteredSelectMultiple, self).render(name, value, attrs, choices)]
|
||||
output.append(u'<script type="text/javascript">addEvent(window, "load", function(e) {')
|
||||
output.append('<script type="text/javascript">addEvent(window, "load", function(e) {')
|
||||
# TODO: "id_" is hard-coded here. This should instead use the correct
|
||||
# API to determine the ID dynamically.
|
||||
output.append(u'SelectFilter.init("id_%s", "%s", %s, "%s"); });</script>\n'
|
||||
output.append('SelectFilter.init("id_%s", "%s", %s, "%s"); });</script>\n'
|
||||
% (name, self.verbose_name.replace('"', '\\"'), int(self.is_stacked), static('admin/')))
|
||||
return mark_safe(u''.join(output))
|
||||
return mark_safe(''.join(output))
|
||||
|
||||
class AdminDateWidget(forms.DateInput):
|
||||
|
||||
|
@ -83,24 +85,24 @@ class AdminSplitDateTime(forms.SplitDateTimeWidget):
|
|||
forms.MultiWidget.__init__(self, widgets, attrs)
|
||||
|
||||
def format_output(self, rendered_widgets):
|
||||
return mark_safe(u'<p class="datetime">%s %s<br />%s %s</p>' % \
|
||||
return mark_safe('<p class="datetime">%s %s<br />%s %s</p>' % \
|
||||
(_('Date:'), rendered_widgets[0], _('Time:'), rendered_widgets[1]))
|
||||
|
||||
class AdminRadioFieldRenderer(RadioFieldRenderer):
|
||||
def render(self):
|
||||
"""Outputs a <ul> for this set of radio fields."""
|
||||
return mark_safe(u'<ul%s>\n%s\n</ul>' % (
|
||||
return mark_safe('<ul%s>\n%s\n</ul>' % (
|
||||
flatatt(self.attrs),
|
||||
u'\n'.join([u'<li>%s</li>' % force_unicode(w) for w in self]))
|
||||
'\n'.join(['<li>%s</li>' % force_unicode(w) for w in self]))
|
||||
)
|
||||
|
||||
class AdminRadioSelect(forms.RadioSelect):
|
||||
renderer = AdminRadioFieldRenderer
|
||||
|
||||
class AdminFileWidget(forms.ClearableFileInput):
|
||||
template_with_initial = (u'<p class="file-upload">%s</p>'
|
||||
template_with_initial = ('<p class="file-upload">%s</p>'
|
||||
% forms.ClearableFileInput.template_with_initial)
|
||||
template_with_clear = (u'<span class="clearable-file-input">%s</span>'
|
||||
template_with_clear = ('<span class="clearable-file-input">%s</span>'
|
||||
% forms.ClearableFileInput.template_with_clear)
|
||||
|
||||
def url_params_from_lookup_dict(lookups):
|
||||
|
@ -113,7 +115,7 @@ def url_params_from_lookup_dict(lookups):
|
|||
items = []
|
||||
for k, v in lookups.items():
|
||||
if isinstance(v, (tuple, list)):
|
||||
v = u','.join([str(x) for x in v])
|
||||
v = ','.join([str(x) for x in v])
|
||||
elif isinstance(v, bool):
|
||||
# See django.db.fields.BooleanField.get_prep_lookup
|
||||
v = ('0', '1')[v]
|
||||
|
@ -148,21 +150,21 @@ class ForeignKeyRawIdWidget(forms.TextInput):
|
|||
|
||||
params = self.url_parameters()
|
||||
if params:
|
||||
url = u'?' + u'&'.join([u'%s=%s' % (k, v) for k, v in params.items()])
|
||||
url = '?' + '&'.join(['%s=%s' % (k, v) for k, v in params.items()])
|
||||
else:
|
||||
url = u''
|
||||
url = ''
|
||||
if "class" not in attrs:
|
||||
attrs['class'] = 'vForeignKeyRawIdAdminField' # The JavaScript code looks for this hook.
|
||||
# TODO: "lookup_id_" is hard-coded here. This should instead use
|
||||
# the correct API to determine the ID dynamically.
|
||||
extra.append(u'<a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> '
|
||||
extra.append('<a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> '
|
||||
% (related_url, url, name))
|
||||
extra.append(u'<img src="%s" width="16" height="16" alt="%s" /></a>'
|
||||
extra.append('<img src="%s" width="16" height="16" alt="%s" /></a>'
|
||||
% (static('admin/img/selector-search.gif'), _('Lookup')))
|
||||
output = [super(ForeignKeyRawIdWidget, self).render(name, value, attrs)] + extra
|
||||
if value:
|
||||
output.append(self.label_for_value(value))
|
||||
return mark_safe(u''.join(output))
|
||||
return mark_safe(''.join(output))
|
||||
|
||||
def base_url_parameters(self):
|
||||
return url_params_from_lookup_dict(self.rel.limit_choices_to)
|
||||
|
@ -261,11 +263,11 @@ class RelatedFieldWidgetWrapper(forms.Widget):
|
|||
related_url = reverse('admin:%s_%s_add' % info, current_app=self.admin_site.name)
|
||||
# TODO: "add_id_" is hard-coded here. This should instead use the
|
||||
# correct API to determine the ID dynamically.
|
||||
output.append(u'<a href="%s" class="add-another" id="add_id_%s" onclick="return showAddAnotherPopup(this);"> '
|
||||
output.append('<a href="%s" class="add-another" id="add_id_%s" onclick="return showAddAnotherPopup(this);"> '
|
||||
% (related_url, name))
|
||||
output.append(u'<img src="%s" width="10" height="10" alt="%s"/></a>'
|
||||
output.append('<img src="%s" width="10" height="10" alt="%s"/></a>'
|
||||
% (static('admin/img/icon_addlink.gif'), _('Add Another')))
|
||||
return mark_safe(u''.join(output))
|
||||
return mark_safe(''.join(output))
|
||||
|
||||
def build_attrs(self, extra_attrs=None, **kwargs):
|
||||
"Helper function for building an attribute dictionary."
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django.contrib.admindocs import views
|
||||
from django.db.models import fields as builtin_fields
|
||||
|
@ -20,17 +20,17 @@ class TestFieldType(unittest.TestCase):
|
|||
def test_builtin_fields(self):
|
||||
self.assertEqual(
|
||||
views.get_readable_field_data_type(builtin_fields.BooleanField()),
|
||||
_(u'Boolean (Either True or False)')
|
||||
_('Boolean (Either True or False)')
|
||||
)
|
||||
|
||||
def test_custom_fields(self):
|
||||
self.assertEqual(
|
||||
views.get_readable_field_data_type(fields.CustomField()),
|
||||
_(u'A custom field type')
|
||||
_('A custom field type')
|
||||
)
|
||||
self.assertEqual(
|
||||
views.get_readable_field_data_type(fields.DescriptionLackingField()),
|
||||
_(u'Field of type: %(field_type)s') % {
|
||||
_('Field of type: %(field_type)s') % {
|
||||
'field_type': 'DescriptionLackingField'
|
||||
}
|
||||
)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.contrib.auth.models import User, Permission
|
||||
|
||||
|
||||
|
@ -36,7 +38,7 @@ class ModelBackend(object):
|
|||
if user_obj.is_anonymous() or obj is not None:
|
||||
return set()
|
||||
if not hasattr(user_obj, '_perm_cache'):
|
||||
user_obj._perm_cache = set([u"%s.%s" % (p.content_type.app_label, p.codename) for p in user_obj.user_permissions.select_related()])
|
||||
user_obj._perm_cache = set(["%s.%s" % (p.content_type.app_label, p.codename) for p in user_obj.user_permissions.select_related()])
|
||||
user_obj._perm_cache.update(self.get_group_permissions(user_obj))
|
||||
return user_obj._perm_cache
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import hashlib
|
||||
|
||||
from django.dispatch import receiver
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
"""
|
||||
Creates permissions for all installed apps that need permissions.
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import getpass
|
||||
import locale
|
||||
import unicodedata
|
||||
|
@ -10,14 +12,14 @@ from django.contrib.auth.models import User
|
|||
|
||||
|
||||
def _get_permission_codename(action, opts):
|
||||
return u'%s_%s' % (action, opts.object_name.lower())
|
||||
return '%s_%s' % (action, opts.object_name.lower())
|
||||
|
||||
|
||||
def _get_all_permissions(opts):
|
||||
"Returns (codename, name) for all permissions in the given opts."
|
||||
perms = []
|
||||
for action in ('add', 'change', 'delete'):
|
||||
perms.append((_get_permission_codename(action, opts), u'Can %s %s' % (action, opts.verbose_name_raw)))
|
||||
perms.append((_get_permission_codename(action, opts), 'Can %s %s' % (action, opts.verbose_name_raw)))
|
||||
return perms + list(opts.permissions)
|
||||
|
||||
|
||||
|
@ -88,7 +90,7 @@ def get_system_username():
|
|||
# if there is no corresponding entry in the /etc/passwd file
|
||||
# (a very restricted chroot environment, for example).
|
||||
# UnicodeDecodeError - preventive treatment for non-latin Windows.
|
||||
return u''
|
||||
return ''
|
||||
|
||||
|
||||
def get_default_username(check_db=True):
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import urllib
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
@ -76,7 +78,7 @@ class Permission(models.Model):
|
|||
'codename')
|
||||
|
||||
def __unicode__(self):
|
||||
return u"%s | %s | %s" % (
|
||||
return "%s | %s | %s" % (
|
||||
unicode(self.content_type.app_label),
|
||||
unicode(self.content_type),
|
||||
unicode(self.name))
|
||||
|
@ -285,7 +287,7 @@ class User(models.Model):
|
|||
"""
|
||||
Returns the first_name plus the last_name, with a space in between.
|
||||
"""
|
||||
full_name = u'%s %s' % (self.first_name, self.last_name)
|
||||
full_name = '%s %s' % (self.first_name, self.last_name)
|
||||
return full_name.strip()
|
||||
|
||||
def set_password(self, raw_password):
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User, Group, Permission, AnonymousUser
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
|
@ -51,7 +53,7 @@ class BackendTest(TestCase):
|
|||
|
||||
# reloading user to purge the _perm_cache
|
||||
user = User.objects.get(username='test')
|
||||
self.assertEqual(user.get_all_permissions() == set([u'auth.test']), True)
|
||||
self.assertEqual(user.get_all_permissions() == set(['auth.test']), True)
|
||||
self.assertEqual(user.get_group_permissions(), set([]))
|
||||
self.assertEqual(user.has_module_perms('Group'), False)
|
||||
self.assertEqual(user.has_module_perms('auth'), True)
|
||||
|
@ -62,7 +64,7 @@ class BackendTest(TestCase):
|
|||
user.user_permissions.add(perm)
|
||||
user.save()
|
||||
user = User.objects.get(username='test')
|
||||
self.assertEqual(user.get_all_permissions(), set([u'auth.test2', u'auth.test', u'auth.test3']))
|
||||
self.assertEqual(user.get_all_permissions(), set(['auth.test2', 'auth.test', 'auth.test3']))
|
||||
self.assertEqual(user.has_perm('test'), False)
|
||||
self.assertEqual(user.has_perm('auth.test'), True)
|
||||
self.assertEqual(user.has_perms(['auth.test2', 'auth.test3']), True)
|
||||
|
@ -72,9 +74,9 @@ class BackendTest(TestCase):
|
|||
group.save()
|
||||
user.groups.add(group)
|
||||
user = User.objects.get(username='test')
|
||||
exp = set([u'auth.test2', u'auth.test', u'auth.test3', u'auth.test_group'])
|
||||
exp = set(['auth.test2', 'auth.test', 'auth.test3', 'auth.test_group'])
|
||||
self.assertEqual(user.get_all_permissions(), exp)
|
||||
self.assertEqual(user.get_group_permissions(), set([u'auth.test_group']))
|
||||
self.assertEqual(user.get_group_permissions(), set(['auth.test_group']))
|
||||
self.assertEqual(user.has_perms(['auth.test3', 'auth.test_group']), True)
|
||||
|
||||
user = AnonymousUser()
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.forms import (UserCreationForm, AuthenticationForm,
|
||||
|
@ -299,7 +301,7 @@ class PasswordResetFormTest(TestCase):
|
|||
# potential case where contrib.sites is not installed. Refs #16412.
|
||||
form.save(domain_override='example.com')
|
||||
self.assertEqual(len(mail.outbox), 1)
|
||||
self.assertEqual(mail.outbox[0].subject, u'Custom password reset on example.com')
|
||||
self.assertEqual(mail.outbox[0].subject, 'Custom password reset on example.com')
|
||||
|
||||
def test_bug_5605(self):
|
||||
# bug #5605, preserve the case of the user name (before the @ in the
|
||||
|
@ -328,4 +330,4 @@ class PasswordResetFormTest(TestCase):
|
|||
form = PasswordResetForm(data)
|
||||
self.assertFalse(form.is_valid())
|
||||
self.assertEqual(form["email"].errors,
|
||||
[_(u"The user account associated with this e-mail address cannot reset the password.")])
|
||||
[_("The user account associated with this e-mail address cannot reset the password.")])
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf.global_settings import PASSWORD_HASHERS as default_hashers
|
||||
from django.contrib.auth.hashers import (is_password_usable,
|
||||
check_password, make_password, PBKDF2PasswordHasher, load_hashers,
|
||||
|
@ -26,7 +28,7 @@ class TestUtilsHashPass(unittest.TestCase):
|
|||
encoded = make_password('letmein')
|
||||
self.assertTrue(encoded.startswith('pbkdf2_sha256$'))
|
||||
self.assertTrue(is_password_usable(encoded))
|
||||
self.assertTrue(check_password(u'letmein', encoded))
|
||||
self.assertTrue(check_password('letmein', encoded))
|
||||
self.assertFalse(check_password('letmeinz', encoded))
|
||||
|
||||
def test_pkbdf2(self):
|
||||
|
@ -34,7 +36,7 @@ class TestUtilsHashPass(unittest.TestCase):
|
|||
self.assertEqual(encoded,
|
||||
'pbkdf2_sha256$10000$seasalt$FQCNpiZpTb0zub+HBsH6TOwyRxJ19FwvjbweatNmK/Y=')
|
||||
self.assertTrue(is_password_usable(encoded))
|
||||
self.assertTrue(check_password(u'letmein', encoded))
|
||||
self.assertTrue(check_password('letmein', encoded))
|
||||
self.assertFalse(check_password('letmeinz', encoded))
|
||||
self.assertEqual(identify_hasher(encoded).algorithm, "pbkdf2_sha256")
|
||||
|
||||
|
@ -43,7 +45,7 @@ class TestUtilsHashPass(unittest.TestCase):
|
|||
self.assertEqual(encoded,
|
||||
'sha1$seasalt$fec3530984afba6bade3347b7140d1a7da7da8c7')
|
||||
self.assertTrue(is_password_usable(encoded))
|
||||
self.assertTrue(check_password(u'letmein', encoded))
|
||||
self.assertTrue(check_password('letmein', encoded))
|
||||
self.assertFalse(check_password('letmeinz', encoded))
|
||||
self.assertEqual(identify_hasher(encoded).algorithm, "sha1")
|
||||
|
||||
|
@ -52,7 +54,7 @@ class TestUtilsHashPass(unittest.TestCase):
|
|||
self.assertEqual(encoded,
|
||||
'md5$seasalt$f5531bef9f3687d0ccf0f617f0e25573')
|
||||
self.assertTrue(is_password_usable(encoded))
|
||||
self.assertTrue(check_password(u'letmein', encoded))
|
||||
self.assertTrue(check_password('letmein', encoded))
|
||||
self.assertFalse(check_password('letmeinz', encoded))
|
||||
self.assertEqual(identify_hasher(encoded).algorithm, "md5")
|
||||
|
||||
|
@ -60,7 +62,7 @@ class TestUtilsHashPass(unittest.TestCase):
|
|||
encoded = make_password('letmein', 'seasalt', 'unsalted_md5')
|
||||
self.assertEqual(encoded, '0d107d09f5bbe40cade3de5c71e9e9b7')
|
||||
self.assertTrue(is_password_usable(encoded))
|
||||
self.assertTrue(check_password(u'letmein', encoded))
|
||||
self.assertTrue(check_password('letmein', encoded))
|
||||
self.assertFalse(check_password('letmeinz', encoded))
|
||||
self.assertEqual(identify_hasher(encoded).algorithm, "unsalted_md5")
|
||||
|
||||
|
@ -69,7 +71,7 @@ class TestUtilsHashPass(unittest.TestCase):
|
|||
encoded = make_password('letmein', 'ab', 'crypt')
|
||||
self.assertEqual(encoded, 'crypt$$abN/qM.L/H8EQ')
|
||||
self.assertTrue(is_password_usable(encoded))
|
||||
self.assertTrue(check_password(u'letmein', encoded))
|
||||
self.assertTrue(check_password('letmein', encoded))
|
||||
self.assertFalse(check_password('letmeinz', encoded))
|
||||
self.assertEqual(identify_hasher(encoded).algorithm, "crypt")
|
||||
|
||||
|
@ -78,7 +80,7 @@ class TestUtilsHashPass(unittest.TestCase):
|
|||
encoded = make_password('letmein', hasher='bcrypt')
|
||||
self.assertTrue(is_password_usable(encoded))
|
||||
self.assertTrue(encoded.startswith('bcrypt$'))
|
||||
self.assertTrue(check_password(u'letmein', encoded))
|
||||
self.assertTrue(check_password('letmein', encoded))
|
||||
self.assertFalse(check_password('letmeinz', encoded))
|
||||
self.assertEqual(identify_hasher(encoded).algorithm, "bcrypt")
|
||||
|
||||
|
@ -88,7 +90,7 @@ class TestUtilsHashPass(unittest.TestCase):
|
|||
self.assertFalse(check_password(None, encoded))
|
||||
self.assertFalse(check_password(UNUSABLE_PASSWORD, encoded))
|
||||
self.assertFalse(check_password('', encoded))
|
||||
self.assertFalse(check_password(u'letmein', encoded))
|
||||
self.assertFalse(check_password('letmein', encoded))
|
||||
self.assertFalse(check_password('letmeinz', encoded))
|
||||
self.assertRaises(ValueError, identify_hasher, encoded)
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from StringIO import StringIO
|
||||
|
||||
from django.contrib.auth import models, management
|
||||
|
@ -15,19 +17,19 @@ class GetDefaultUsernameTestCase(TestCase):
|
|||
management.get_system_username = self._getpass_getuser
|
||||
|
||||
def test_simple(self):
|
||||
management.get_system_username = lambda: u'joe'
|
||||
management.get_system_username = lambda: 'joe'
|
||||
self.assertEqual(management.get_default_username(), 'joe')
|
||||
|
||||
def test_existing(self):
|
||||
models.User.objects.create(username='joe')
|
||||
management.get_system_username = lambda: u'joe'
|
||||
management.get_system_username = lambda: 'joe'
|
||||
self.assertEqual(management.get_default_username(), '')
|
||||
self.assertEqual(
|
||||
management.get_default_username(check_db=False), 'joe')
|
||||
|
||||
def test_i18n(self):
|
||||
# 'Julia' with accented 'u':
|
||||
management.get_system_username = lambda: u'J\xfalia'
|
||||
management.get_system_username = lambda: 'J\xfalia'
|
||||
self.assertEqual(management.get_default_username(), 'julia')
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.contrib import admin
|
||||
from django.contrib.comments.models import Comment
|
||||
from django.utils.translation import ugettext_lazy as _, ungettext
|
||||
|
@ -62,8 +64,8 @@ class CommentsAdmin(admin.ModelAdmin):
|
|||
action(request, comment)
|
||||
n_comments += 1
|
||||
|
||||
msg = ungettext(u'1 comment was successfully %(action)s.',
|
||||
u'%(count)s comments were successfully %(action)s.',
|
||||
msg = ungettext('1 comment was successfully %(action)s.',
|
||||
'%(count)s comments were successfully %(action)s.',
|
||||
n_comments)
|
||||
self.message_user(request, msg % {'count': n_comments, 'action': done_message(n_comments)})
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""
|
||||
Classes allowing "generic" relations through ContentType and object-id fields.
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from collections import defaultdict
|
||||
from functools import partial
|
||||
|
@ -131,7 +132,7 @@ class GenericForeignKey(object):
|
|||
|
||||
def __set__(self, instance, value):
|
||||
if instance is None:
|
||||
raise AttributeError(u"%s must be accessed via instance" % self.related.opts.object_name)
|
||||
raise AttributeError("%s must be accessed via instance" % self.related.opts.object_name)
|
||||
|
||||
ct = None
|
||||
fk = None
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import urllib
|
||||
|
||||
from django.db import models
|
||||
|
@ -181,4 +183,4 @@ class ContentTypesTests(TestCase):
|
|||
app_label = 'contenttypes',
|
||||
model = 'OldModel',
|
||||
)
|
||||
self.assertEqual(unicode(ct), u'Old model')
|
||||
self.assertEqual(unicode(ct), 'Old model')
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django import http
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.sites.models import Site, get_current_site
|
||||
|
@ -12,11 +14,11 @@ def shortcut(request, content_type_id, object_id):
|
|||
try:
|
||||
content_type = ContentType.objects.get(pk=content_type_id)
|
||||
if not content_type.model_class():
|
||||
raise http.Http404(_(u"Content type %(ct_id)s object has no associated model") %
|
||||
raise http.Http404(_("Content type %(ct_id)s object has no associated model") %
|
||||
{'ct_id': content_type_id})
|
||||
obj = content_type.get_object_for_this_type(pk=object_id)
|
||||
except (ObjectDoesNotExist, ValueError):
|
||||
raise http.Http404(_(u"Content type %(ct_id)s object %(obj_id)s doesn't exist") %
|
||||
raise http.Http404(_("Content type %(ct_id)s object %(obj_id)s doesn't exist") %
|
||||
{'ct_id': content_type_id, 'obj_id': object_id})
|
||||
|
||||
try:
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
These classes are light wrappers around Django's database API that provide
|
||||
convenience functionality and permalink functions for the databrowse app.
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models
|
||||
from django.utils import formats
|
||||
|
@ -61,7 +62,7 @@ class EasyField(object):
|
|||
self.model, self.field = easy_model, field
|
||||
|
||||
def __repr__(self):
|
||||
return smart_str(u'<EasyField for %s.%s>' % (self.model.model._meta.object_name, self.field.name))
|
||||
return smart_str('<EasyField for %s.%s>' % (self.model.model._meta.object_name, self.field.name))
|
||||
|
||||
def choices(self):
|
||||
for value, label in self.field.choices:
|
||||
|
@ -79,7 +80,7 @@ class EasyChoice(object):
|
|||
self.value, self.label = value, label
|
||||
|
||||
def __repr__(self):
|
||||
return smart_str(u'<EasyChoice for %s.%s>' % (self.model.model._meta.object_name, self.field.name))
|
||||
return smart_str('<EasyChoice for %s.%s>' % (self.model.model._meta.object_name, self.field.name))
|
||||
|
||||
def url(self):
|
||||
return mark_safe('%s%s/%s/%s/%s/' % (self.model.site.root_url, self.model.model._meta.app_label, self.model.model._meta.module_name, self.field.field.name, iri_to_uri(self.value)))
|
||||
|
@ -89,12 +90,12 @@ class EasyInstance(object):
|
|||
self.model, self.instance = easy_model, instance
|
||||
|
||||
def __repr__(self):
|
||||
return smart_str(u'<EasyInstance for %s (%s)>' % (self.model.model._meta.object_name, self.instance._get_pk_val()))
|
||||
return smart_str('<EasyInstance for %s (%s)>' % (self.model.model._meta.object_name, self.instance._get_pk_val()))
|
||||
|
||||
def __unicode__(self):
|
||||
val = smart_unicode(self.instance)
|
||||
if len(val) > DISPLAY_SIZE:
|
||||
return val[:DISPLAY_SIZE] + u'...'
|
||||
return val[:DISPLAY_SIZE] + '...'
|
||||
return val
|
||||
|
||||
def __str__(self):
|
||||
|
@ -136,7 +137,7 @@ class EasyInstanceField(object):
|
|||
self.raw_value = getattr(instance.instance, field.name)
|
||||
|
||||
def __repr__(self):
|
||||
return smart_str(u'<EasyInstanceField for %s.%s>' % (self.model.model._meta.object_name, self.field.name))
|
||||
return smart_str('<EasyInstanceField for %s.%s>' % (self.model.model._meta.object_name, self.field.name))
|
||||
|
||||
def values(self):
|
||||
"""
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django import http
|
||||
from django.db import models
|
||||
from django.contrib.databrowse.datastructures import EasyModel
|
||||
|
@ -61,14 +63,14 @@ class CalendarPlugin(DatabrowsePlugin):
|
|||
def model_index_html(self, request, model, site):
|
||||
fields = self.field_dict(model)
|
||||
if not fields:
|
||||
return u''
|
||||
return mark_safe(u'<p class="filter"><strong>View calendar by:</strong> %s</p>' % \
|
||||
u', '.join(['<a href="calendars/%s/">%s</a>' % (f.name, force_unicode(capfirst(f.verbose_name))) for f in fields.values()]))
|
||||
return ''
|
||||
return mark_safe('<p class="filter"><strong>View calendar by:</strong> %s</p>' % \
|
||||
', '.join(['<a href="calendars/%s/">%s</a>' % (f.name, force_unicode(capfirst(f.verbose_name))) for f in fields.values()]))
|
||||
|
||||
def urls(self, plugin_name, easy_instance_field):
|
||||
if isinstance(easy_instance_field.field, models.DateField):
|
||||
d = easy_instance_field.raw_value
|
||||
return [mark_safe(u'%s%s/%s/%s/%s/%s/' % (
|
||||
return [mark_safe('%s%s/%s/%s/%s/%s/' % (
|
||||
easy_instance_field.model.url(),
|
||||
plugin_name, easy_instance_field.field.name,
|
||||
str(d.year),
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django import http
|
||||
from django.db import models
|
||||
from django.contrib.databrowse.datastructures import EasyModel
|
||||
|
@ -29,14 +31,14 @@ class FieldChoicePlugin(DatabrowsePlugin):
|
|||
def model_index_html(self, request, model, site):
|
||||
fields = self.field_dict(model)
|
||||
if not fields:
|
||||
return u''
|
||||
return mark_safe(u'<p class="filter"><strong>View by:</strong> %s</p>' % \
|
||||
u', '.join(['<a href="fields/%s/">%s</a>' % (f.name, force_unicode(capfirst(f.verbose_name))) for f in fields.values()]))
|
||||
return ''
|
||||
return mark_safe('<p class="filter"><strong>View by:</strong> %s</p>' % \
|
||||
', '.join(['<a href="fields/%s/">%s</a>' % (f.name, force_unicode(capfirst(f.verbose_name))) for f in fields.values()]))
|
||||
|
||||
def urls(self, plugin_name, easy_instance_field):
|
||||
if easy_instance_field.field in self.field_dict(easy_instance_field.model.model).values():
|
||||
field_value = smart_str(easy_instance_field.raw_value)
|
||||
return [mark_safe(u'%s%s/%s/%s/' % (
|
||||
return [mark_safe('%s%s/%s/%s/' % (
|
||||
easy_instance_field.model.url(),
|
||||
plugin_name, easy_instance_field.field.name,
|
||||
urllib.quote(field_value, safe='')))]
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django import http
|
||||
from django.db import models
|
||||
from django.contrib.databrowse.datastructures import EasyModel
|
||||
|
@ -61,7 +63,7 @@ class ModelDatabrowse(object):
|
|||
|
||||
def main_view(self, request):
|
||||
easy_model = EasyModel(self.site, self.model)
|
||||
html_snippets = mark_safe(u'\n'.join([p.model_index_html(request, self.model, self.site) for p in self.plugins.values()]))
|
||||
html_snippets = mark_safe('\n'.join([p.model_index_html(request, self.model, self.site) for p in self.plugins.values()]))
|
||||
return render_to_response('databrowse/model_detail.html', {
|
||||
'model': easy_model,
|
||||
'root_url': self.site.root_url,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models
|
||||
from django.contrib.sites.models import Site
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
@ -20,7 +22,7 @@ class FlatPage(models.Model):
|
|||
ordering = ('url',)
|
||||
|
||||
def __unicode__(self):
|
||||
return u"%s -- %s" % (self.url, self.title)
|
||||
return "%s -- %s" % (self.url, self.title)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return self.url
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.flatpages.forms import FlatpageForm
|
||||
from django.contrib.flatpages.models import FlatPage
|
||||
|
@ -60,7 +62,7 @@ class FlatpageAdminFormTests(TestCase):
|
|||
|
||||
self.assertEqual(
|
||||
f.errors,
|
||||
{'__all__': [u'Flatpage with url /myflatpage1/ already exists for site example.com']})
|
||||
{'__all__': ['Flatpage with url /myflatpage1/ already exists for site example.com']})
|
||||
|
||||
def test_flatpage_admin_form_edit(self):
|
||||
"""
|
||||
|
@ -92,5 +94,5 @@ class FlatpageAdminFormTests(TestCase):
|
|||
|
||||
self.assertEqual(
|
||||
f.errors,
|
||||
{'sites': [translation.ugettext(u'This field is required.')]})
|
||||
{'sites': [translation.ugettext('This field is required.')]})
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import re
|
||||
import warnings
|
||||
|
@ -41,7 +43,7 @@ class PreviewTests(TestCase):
|
|||
self.preview = preview.FormPreview(TestForm)
|
||||
input_template = '<input type="hidden" name="%s" value="%s" />'
|
||||
self.input = input_template % (self.preview.unused_name('stage'), "%d")
|
||||
self.test_data = {'field1':u'foo', 'field1_':u'asdf'}
|
||||
self.test_data = {'field1': 'foo', 'field1_': 'asdf'}
|
||||
|
||||
def test_unused_name(self):
|
||||
"""
|
||||
|
@ -117,7 +119,7 @@ class PreviewTests(TestCase):
|
|||
"""
|
||||
self.test_data.update({'stage':2})
|
||||
hash = self.preview.security_hash(None, TestForm(self.test_data))
|
||||
self.test_data.update({'hash':hash, 'bool1':u'False'})
|
||||
self.test_data.update({'hash': hash, 'bool1': 'False'})
|
||||
with warnings.catch_warnings(record=True):
|
||||
response = self.client.post('/preview/', self.test_data)
|
||||
self.assertEqual(response.content, success_string)
|
||||
|
@ -163,8 +165,8 @@ class FormHmacTests(unittest.TestCase):
|
|||
leading/trailing whitespace so as to be friendly to broken browsers that
|
||||
submit it (usually in textareas).
|
||||
"""
|
||||
f1 = HashTestForm({'name': u'joe', 'bio': u'Nothing notable.'})
|
||||
f2 = HashTestForm({'name': u' joe', 'bio': u'Nothing notable. '})
|
||||
f1 = HashTestForm({'name': 'joe', 'bio': 'Nothing notable.'})
|
||||
f2 = HashTestForm({'name': ' joe', 'bio': 'Nothing notable. '})
|
||||
hash1 = utils.form_hmac(f1)
|
||||
hash2 = utils.form_hmac(f2)
|
||||
self.assertEqual(hash1, hash2)
|
||||
|
@ -266,10 +268,10 @@ class WizardTests(TestCase):
|
|||
Form should advance if the hash is present and good, as calculated using
|
||||
current method.
|
||||
"""
|
||||
data = {"0-field": u"test",
|
||||
"1-field": u"test2",
|
||||
"hash_0": u"cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca",
|
||||
"wizard_step": u"1"}
|
||||
data = {"0-field": "test",
|
||||
"1-field": "test2",
|
||||
"hash_0": "cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca",
|
||||
"wizard_step": "1"}
|
||||
response = self.client.post('/wizard1/', data)
|
||||
self.assertEqual(2, response.context['step0'])
|
||||
|
||||
|
@ -291,18 +293,18 @@ class WizardTests(TestCase):
|
|||
reached[0] = True
|
||||
|
||||
wizard = WizardWithProcessStep([WizardPageOneForm])
|
||||
data = {"0-field": u"test",
|
||||
"1-field": u"test2",
|
||||
"hash_0": u"cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca",
|
||||
"wizard_step": u"1"}
|
||||
data = {"0-field": "test",
|
||||
"1-field": "test2",
|
||||
"hash_0": "cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca",
|
||||
"wizard_step": "1"}
|
||||
wizard(DummyRequest(POST=data))
|
||||
self.assertTrue(reached[0])
|
||||
|
||||
data = {"0-field": u"test",
|
||||
"1-field": u"test2",
|
||||
data = {"0-field": "test",
|
||||
"1-field": "test2",
|
||||
"hash_0": "cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca",
|
||||
"hash_1": u"1e6f6315da42e62f33a30640ec7e007ad3fbf1a1",
|
||||
"wizard_step": u"2"}
|
||||
"hash_1": "1e6f6315da42e62f33a30640ec7e007ad3fbf1a1",
|
||||
"wizard_step": "2"}
|
||||
self.assertRaises(http.Http404, wizard, DummyRequest(POST=data))
|
||||
|
||||
def test_14498(self):
|
||||
|
@ -321,10 +323,10 @@ class WizardTests(TestCase):
|
|||
wizard = WizardWithProcessStep([WizardPageOneForm,
|
||||
WizardPageTwoForm,
|
||||
WizardPageThreeForm])
|
||||
data = {"0-field": u"test",
|
||||
"1-field": u"test2",
|
||||
"hash_0": u"cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca",
|
||||
"wizard_step": u"1"}
|
||||
data = {"0-field": "test",
|
||||
"1-field": "test2",
|
||||
"hash_0": "cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca",
|
||||
"wizard_step": "1"}
|
||||
wizard(DummyRequest(POST=data))
|
||||
self.assertTrue(reached[0])
|
||||
|
||||
|
@ -345,10 +347,10 @@ class WizardTests(TestCase):
|
|||
wizard = Wizard([WizardPageOneForm,
|
||||
WizardPageTwoForm])
|
||||
|
||||
data = {"0-field": u"test",
|
||||
"1-field": u"test2",
|
||||
"hash_0": u"cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca",
|
||||
"wizard_step": u"1"}
|
||||
data = {"0-field": "test",
|
||||
"1-field": "test2",
|
||||
"hash_0": "cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca",
|
||||
"wizard_step": "1"}
|
||||
wizard(DummyRequest(POST=data))
|
||||
self.assertTrue(reached[0])
|
||||
|
||||
|
@ -371,10 +373,10 @@ class WizardTests(TestCase):
|
|||
wizard = WizardWithProcessStep([WizardPageOneForm,
|
||||
WizardPageTwoForm,
|
||||
WizardPageThreeForm])
|
||||
data = {"0-field": u"test",
|
||||
"1-field": u"test2",
|
||||
"hash_0": u"cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca",
|
||||
"wizard_step": u"1"}
|
||||
data = {"0-field": "test",
|
||||
"1-field": "test2",
|
||||
"hash_0": "cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca",
|
||||
"wizard_step": "1"}
|
||||
wizard(DummyRequest(POST=data))
|
||||
self.assertTrue(reached[0])
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django import forms, http
|
||||
from django.conf import settings
|
||||
from django.test import TestCase
|
||||
|
@ -64,22 +66,22 @@ class TestWizard(WizardView):
|
|||
class FormTests(TestCase):
|
||||
def test_form_init(self):
|
||||
testform = TestWizard.get_initkwargs([Step1, Step2])
|
||||
self.assertEqual(testform['form_list'], {u'0': Step1, u'1': Step2})
|
||||
self.assertEqual(testform['form_list'], {'0': Step1, '1': Step2})
|
||||
|
||||
testform = TestWizard.get_initkwargs([('start', Step1), ('step2', Step2)])
|
||||
self.assertEqual(
|
||||
testform['form_list'], {u'start': Step1, u'step2': Step2})
|
||||
testform['form_list'], {'start': Step1, 'step2': Step2})
|
||||
|
||||
testform = TestWizard.get_initkwargs([Step1, Step2, ('finish', Step3)])
|
||||
self.assertEqual(
|
||||
testform['form_list'], {u'0': Step1, u'1': Step2, u'finish': Step3})
|
||||
testform['form_list'], {'0': Step1, '1': Step2, 'finish': Step3})
|
||||
|
||||
def test_first_step(self):
|
||||
request = get_request()
|
||||
|
||||
testform = TestWizard.as_view([Step1, Step2])
|
||||
response, instance = testform(request)
|
||||
self.assertEqual(instance.steps.current, u'0')
|
||||
self.assertEqual(instance.steps.current, '0')
|
||||
|
||||
testform = TestWizard.as_view([('start', Step1), ('step2', Step2)])
|
||||
response, instance = testform(request)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import QueryDict
|
||||
from django.test import TestCase
|
||||
|
@ -51,8 +53,8 @@ class NamedWizardTests(object):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.context['wizard']['steps'].current, 'form1')
|
||||
self.assertEqual(response.context['wizard']['form'].errors,
|
||||
{'name': [u'This field is required.'],
|
||||
'user': [u'This field is required.']})
|
||||
{'name': ['This field is required.'],
|
||||
'user': ['This field is required.']})
|
||||
|
||||
def test_form_post_success(self):
|
||||
response = self.client.post(
|
||||
|
@ -150,10 +152,10 @@ class NamedWizardTests(object):
|
|||
self.assertEqual(all_data[1]['file1'].read(), open(__file__, 'rb').read())
|
||||
del all_data[1]['file1']
|
||||
self.assertEqual(all_data, [
|
||||
{'name': u'Pony', 'thirsty': True, 'user': self.testuser},
|
||||
{'address1': u'123 Main St', 'address2': u'Djangoland'},
|
||||
{'random_crap': u'blah blah'},
|
||||
[{'random_crap': u'blah blah'}, {'random_crap': u'blah blah'}]])
|
||||
{'name': 'Pony', 'thirsty': True, 'user': self.testuser},
|
||||
{'address1': '123 Main St', 'address2': 'Djangoland'},
|
||||
{'random_crap': 'blah blah'},
|
||||
[{'random_crap': 'blah blah'}, {'random_crap': 'blah blah'}]])
|
||||
|
||||
def test_cleaned_data(self):
|
||||
response = self.client.get(
|
||||
|
@ -203,11 +205,11 @@ class NamedWizardTests(object):
|
|||
del all_data['file1']
|
||||
self.assertEqual(
|
||||
all_data,
|
||||
{'name': u'Pony', 'thirsty': True, 'user': self.testuser,
|
||||
'address1': u'123 Main St', 'address2': u'Djangoland',
|
||||
'random_crap': u'blah blah', 'formset-form4': [
|
||||
{'random_crap': u'blah blah'},
|
||||
{'random_crap': u'blah blah'}
|
||||
{'name': 'Pony', 'thirsty': True, 'user': self.testuser,
|
||||
'address1': '123 Main St', 'address2': 'Djangoland',
|
||||
'random_crap': 'blah blah', 'formset-form4': [
|
||||
{'random_crap': 'blah blah'},
|
||||
{'random_crap': 'blah blah'}
|
||||
]})
|
||||
|
||||
def test_manipulated_data(self):
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
|
||||
from django import forms
|
||||
|
@ -33,8 +35,8 @@ class WizardTests(object):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.context['wizard']['steps'].current, 'form1')
|
||||
self.assertEqual(response.context['wizard']['form'].errors,
|
||||
{'name': [u'This field is required.'],
|
||||
'user': [u'This field is required.']})
|
||||
{'name': ['This field is required.'],
|
||||
'user': ['This field is required.']})
|
||||
|
||||
def test_form_post_success(self):
|
||||
response = self.client.post(self.wizard_url, self.wizard_step_data[0])
|
||||
|
@ -96,11 +98,11 @@ class WizardTests(object):
|
|||
self.assertEqual(all_data[1]['file1'].read(), open(__file__, 'rb').read())
|
||||
del all_data[1]['file1']
|
||||
self.assertEqual(all_data, [
|
||||
{'name': u'Pony', 'thirsty': True, 'user': self.testuser},
|
||||
{'address1': u'123 Main St', 'address2': u'Djangoland'},
|
||||
{'random_crap': u'blah blah'},
|
||||
[{'random_crap': u'blah blah'},
|
||||
{'random_crap': u'blah blah'}]])
|
||||
{'name': 'Pony', 'thirsty': True, 'user': self.testuser},
|
||||
{'address1': '123 Main St', 'address2': 'Djangoland'},
|
||||
{'random_crap': 'blah blah'},
|
||||
[{'random_crap': 'blah blah'},
|
||||
{'random_crap': 'blah blah'}]])
|
||||
|
||||
def test_cleaned_data(self):
|
||||
response = self.client.get(self.wizard_url)
|
||||
|
@ -124,11 +126,11 @@ class WizardTests(object):
|
|||
self.assertEqual(all_data['file1'].read(), open(__file__, 'rb').read())
|
||||
del all_data['file1']
|
||||
self.assertEqual(all_data, {
|
||||
'name': u'Pony', 'thirsty': True, 'user': self.testuser,
|
||||
'address1': u'123 Main St', 'address2': u'Djangoland',
|
||||
'random_crap': u'blah blah', 'formset-form4': [
|
||||
{'random_crap': u'blah blah'},
|
||||
{'random_crap': u'blah blah'}]})
|
||||
'name': 'Pony', 'thirsty': True, 'user': self.testuser,
|
||||
'address1': '123 Main St', 'address2': 'Djangoland',
|
||||
'random_crap': 'blah blah', 'formset-form4': [
|
||||
{'random_crap': 'blah blah'},
|
||||
{'random_crap': 'blah blah'}]})
|
||||
|
||||
def test_manipulated_data(self):
|
||||
response = self.client.get(self.wizard_url)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.contrib.syndication.views import Feed as BaseFeed
|
||||
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
|
||||
|
||||
|
@ -13,7 +15,7 @@ class GeoFeedMixin(object):
|
|||
a single white space. Given a tuple of coordinates, this will return
|
||||
a unicode GeoRSS representation.
|
||||
"""
|
||||
return u' '.join([u'%f %f' % (coord[1], coord[0]) for coord in coords])
|
||||
return ' '.join(['%f %f' % (coord[1], coord[0]) for coord in coords])
|
||||
|
||||
def add_georss_point(self, handler, coords, w3c_geo=False):
|
||||
"""
|
||||
|
@ -23,10 +25,10 @@ class GeoFeedMixin(object):
|
|||
"""
|
||||
if w3c_geo:
|
||||
lon, lat = coords[:2]
|
||||
handler.addQuickElement(u'geo:lat', u'%f' % lat)
|
||||
handler.addQuickElement(u'geo:lon', u'%f' % lon)
|
||||
handler.addQuickElement('geo:lat', '%f' % lat)
|
||||
handler.addQuickElement('geo:lon', '%f' % lon)
|
||||
else:
|
||||
handler.addQuickElement(u'georss:point', self.georss_coords((coords,)))
|
||||
handler.addQuickElement('georss:point', self.georss_coords((coords,)))
|
||||
|
||||
def add_georss_element(self, handler, item, w3c_geo=False):
|
||||
"""
|
||||
|
@ -57,7 +59,7 @@ class GeoFeedMixin(object):
|
|||
# If a GeoRSS box was given via tuple.
|
||||
if not box_coords is None:
|
||||
if w3c_geo: raise ValueError('Cannot use simple GeoRSS box in W3C Geo feeds.')
|
||||
handler.addQuickElement(u'georss:box', self.georss_coords(box_coords))
|
||||
handler.addQuickElement('georss:box', self.georss_coords(box_coords))
|
||||
else:
|
||||
# Getting the lower-case geometry type.
|
||||
gtype = str(geom.geom_type).lower()
|
||||
|
@ -68,10 +70,10 @@ class GeoFeedMixin(object):
|
|||
# For formatting consistent w/the GeoRSS simple standard:
|
||||
# http://georss.org/1.0#simple
|
||||
if gtype in ('linestring', 'linearring'):
|
||||
handler.addQuickElement(u'georss:line', self.georss_coords(geom.coords))
|
||||
handler.addQuickElement('georss:line', self.georss_coords(geom.coords))
|
||||
elif gtype in ('polygon',):
|
||||
# Only support the exterior ring.
|
||||
handler.addQuickElement(u'georss:polygon', self.georss_coords(geom[0].coords))
|
||||
handler.addQuickElement('georss:polygon', self.georss_coords(geom[0].coords))
|
||||
else:
|
||||
raise ValueError('Geometry type "%s" not supported.' % geom.geom_type)
|
||||
|
||||
|
@ -79,7 +81,7 @@ class GeoFeedMixin(object):
|
|||
class GeoRSSFeed(Rss201rev2Feed, GeoFeedMixin):
|
||||
def rss_attributes(self):
|
||||
attrs = super(GeoRSSFeed, self).rss_attributes()
|
||||
attrs[u'xmlns:georss'] = u'http://www.georss.org/georss'
|
||||
attrs['xmlns:georss'] = 'http://www.georss.org/georss'
|
||||
return attrs
|
||||
|
||||
def add_item_elements(self, handler, item):
|
||||
|
@ -93,7 +95,7 @@ class GeoRSSFeed(Rss201rev2Feed, GeoFeedMixin):
|
|||
class GeoAtom1Feed(Atom1Feed, GeoFeedMixin):
|
||||
def root_attributes(self):
|
||||
attrs = super(GeoAtom1Feed, self).root_attributes()
|
||||
attrs[u'xmlns:georss'] = u'http://www.georss.org/georss'
|
||||
attrs['xmlns:georss'] = 'http://www.georss.org/georss'
|
||||
return attrs
|
||||
|
||||
def add_item_elements(self, handler, item):
|
||||
|
@ -107,7 +109,7 @@ class GeoAtom1Feed(Atom1Feed, GeoFeedMixin):
|
|||
class W3CGeoFeed(Rss201rev2Feed, GeoFeedMixin):
|
||||
def rss_attributes(self):
|
||||
attrs = super(W3CGeoFeed, self).rss_attributes()
|
||||
attrs[u'xmlns:geo'] = u'http://www.w3.org/2003/01/geo/wgs84_pos#'
|
||||
attrs['xmlns:geo'] = 'http://www.w3.org/2003/01/geo/wgs84_pos#'
|
||||
return attrs
|
||||
|
||||
def add_item_elements(self, handler, item):
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django import forms
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
@ -14,10 +16,10 @@ class GeometryField(forms.Field):
|
|||
widget = forms.Textarea
|
||||
|
||||
default_error_messages = {
|
||||
'no_geom' : _(u'No geometry value provided.'),
|
||||
'invalid_geom' : _(u'Invalid geometry value.'),
|
||||
'invalid_geom_type' : _(u'Invalid geometry type.'),
|
||||
'transform_error' : _(u'An error occurred when transforming the geometry '
|
||||
'no_geom' : _('No geometry value provided.'),
|
||||
'invalid_geom' : _('Invalid geometry value.'),
|
||||
'invalid_geom_type' : _('Invalid geometry type.'),
|
||||
'transform_error' : _('An error occurred when transforming the geometry '
|
||||
'to the SRID of the geometry form field.'),
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class EnvelopeTest(unittest.TestCase):
|
|||
self.assertRaises(OGRException, Envelope, (0, 0, 5, 5, 3))
|
||||
self.assertRaises(OGRException, Envelope, ())
|
||||
self.assertRaises(ValueError, Envelope, 0, 'a', 5, 5)
|
||||
self.assertRaises(TypeError, Envelope, u'foo')
|
||||
self.assertRaises(TypeError, Envelope, 'foo')
|
||||
self.assertRaises(OGRException, Envelope, (1, 1, 0, 0))
|
||||
try:
|
||||
Envelope(0, 0, 0, 0)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
from django.conf import settings
|
||||
from django.contrib.gis.geos import GEOSGeometry
|
||||
|
@ -99,13 +101,13 @@ class GeoIPTest(unittest.TestCase):
|
|||
"Testing that GeoIP strings are properly encoded, see #16553."
|
||||
g = GeoIP()
|
||||
d = g.city('62.224.93.23')
|
||||
self.assertEqual(u'Sch\xf6mberg', d['city'])
|
||||
self.assertEqual('Schümberg', d['city'])
|
||||
|
||||
def test06_unicode_query(self):
|
||||
"Testing that GeoIP accepts unicode string queries, see #17059."
|
||||
g = GeoIP()
|
||||
d = g.country(u'whitehouse.gov')
|
||||
self.assertEqual(u'US', d['country_code'])
|
||||
d = g.country('whitehouse.gov')
|
||||
self.assertEqual('US', d['country_code'])
|
||||
|
||||
|
||||
def suite():
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.http import HttpResponse, Http404
|
||||
from django.template import loader
|
||||
from django.contrib.sites.models import get_current_site
|
||||
|
@ -41,7 +43,7 @@ def sitemap(request, sitemaps, section=None):
|
|||
maps, urls = [], []
|
||||
if section is not None:
|
||||
if section not in sitemaps:
|
||||
raise Http404(_(u"No sitemap available for section: %r") % section)
|
||||
raise Http404(_("No sitemap available for section: %r") % section)
|
||||
maps.append(sitemaps[section])
|
||||
else:
|
||||
maps = sitemaps.values()
|
||||
|
@ -55,9 +57,9 @@ def sitemap(request, sitemaps, section=None):
|
|||
else:
|
||||
urls.extend(site.get_urls(page=page, site=current_site))
|
||||
except EmptyPage:
|
||||
raise Http404(_(u"Page %s empty") % page)
|
||||
raise Http404(_("Page %s empty") % page)
|
||||
except PageNotAnInteger:
|
||||
raise Http404(_(u"No page '%s'") % page)
|
||||
raise Http404(_("No page '%s'") % page)
|
||||
xml = smart_str(loader.render_to_string('gis/sitemaps/geo_sitemap.xml', {'urlset': urls}))
|
||||
return HttpResponse(xml, content_type='application/xml')
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class GeoFeedTest(TestCase):
|
|||
# Incrementing through the feeds.
|
||||
for feed in [feed1, feed2]:
|
||||
# Ensuring the georss namespace was added to the <rss> element.
|
||||
self.assertEqual(feed.getAttribute(u'xmlns:georss'), u'http://www.georss.org/georss')
|
||||
self.assertEqual(feed.getAttribute('xmlns:georss'), 'http://www.georss.org/georss')
|
||||
chan = feed.getElementsByTagName('channel')[0]
|
||||
items = chan.getElementsByTagName('item')
|
||||
self.assertEqual(len(items), City.objects.count())
|
||||
|
@ -64,7 +64,7 @@ class GeoFeedTest(TestCase):
|
|||
|
||||
for feed in [feed1, feed2]:
|
||||
# Ensuring the georsss namespace was added to the <feed> element.
|
||||
self.assertEqual(feed.getAttribute(u'xmlns:georss'), u'http://www.georss.org/georss')
|
||||
self.assertEqual(feed.getAttribute('xmlns:georss'), 'http://www.georss.org/georss')
|
||||
entries = feed.getElementsByTagName('entry')
|
||||
self.assertEqual(len(entries), City.objects.count())
|
||||
|
||||
|
@ -77,7 +77,7 @@ class GeoFeedTest(TestCase):
|
|||
doc = minidom.parseString(self.client.get('/feeds/w3cgeo1/').content)
|
||||
feed = doc.firstChild
|
||||
# Ensuring the geo namespace was added to the <feed> element.
|
||||
self.assertEqual(feed.getAttribute(u'xmlns:geo'), u'http://www.w3.org/2003/01/geo/wgs84_pos#')
|
||||
self.assertEqual(feed.getAttribute('xmlns:geo'), 'http://www.w3.org/2003/01/geo/wgs84_pos#')
|
||||
chan = feed.getElementsByTagName('channel')[0]
|
||||
items = chan.getElementsByTagName('item')
|
||||
self.assertEqual(len(items), City.objects.count())
|
||||
|
|
|
@ -34,7 +34,7 @@ class GeoSitemapTest(TestCase):
|
|||
# Getting the geo index.
|
||||
doc = minidom.parseString(self.client.get('/sitemap.xml').content)
|
||||
index = doc.firstChild
|
||||
self.assertEqual(index.getAttribute(u'xmlns'), u'http://www.sitemaps.org/schemas/sitemap/0.9')
|
||||
self.assertEqual(index.getAttribute('xmlns'), 'http://www.sitemaps.org/schemas/sitemap/0.9')
|
||||
self.assertEqual(3, len(index.getElementsByTagName('sitemap')))
|
||||
|
||||
def test_geositemap_kml(self):
|
||||
|
@ -44,8 +44,8 @@ class GeoSitemapTest(TestCase):
|
|||
|
||||
# Ensuring the right sitemaps namespaces are present.
|
||||
urlset = doc.firstChild
|
||||
self.assertEqual(urlset.getAttribute(u'xmlns'), u'http://www.sitemaps.org/schemas/sitemap/0.9')
|
||||
self.assertEqual(urlset.getAttribute(u'xmlns:geo'), u'http://www.google.com/geo/schemas/sitemap/1.0')
|
||||
self.assertEqual(urlset.getAttribute('xmlns'), 'http://www.sitemaps.org/schemas/sitemap/0.9')
|
||||
self.assertEqual(urlset.getAttribute('xmlns:geo'), 'http://www.google.com/geo/schemas/sitemap/1.0')
|
||||
|
||||
urls = urlset.getElementsByTagName('url')
|
||||
self.assertEqual(2, len(urls)) # Should only be 2 sitemaps.
|
||||
|
@ -84,8 +84,8 @@ class GeoSitemapTest(TestCase):
|
|||
|
||||
# Ensuring the right sitemaps namespaces are present.
|
||||
urlset = doc.firstChild
|
||||
self.assertEqual(urlset.getAttribute(u'xmlns'), u'http://www.sitemaps.org/schemas/sitemap/0.9')
|
||||
self.assertEqual(urlset.getAttribute(u'xmlns:geo'), u'http://www.google.com/geo/schemas/sitemap/1.0')
|
||||
self.assertEqual(urlset.getAttribute('xmlns'), 'http://www.sitemaps.org/schemas/sitemap/0.9')
|
||||
self.assertEqual(urlset.getAttribute('xmlns:geo'), 'http://www.google.com/geo/schemas/sitemap/1.0')
|
||||
|
||||
# Making sure the correct number of feed URLs were included.
|
||||
urls = urlset.getElementsByTagName('url')
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.http import Http404
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
def feed(request, url, feed_dict=None):
|
||||
"""Provided for backwards compatibility."""
|
||||
if not feed_dict:
|
||||
raise Http404(_(u"No feeds are registered."))
|
||||
raise Http404(_("No feeds are registered."))
|
||||
|
||||
try:
|
||||
slug, param = url.split('/', 1)
|
||||
|
@ -14,7 +16,7 @@ def feed(request, url, feed_dict=None):
|
|||
try:
|
||||
f = feed_dict[slug]
|
||||
except KeyError:
|
||||
raise Http404(_(u"Slug %r isn't registered.") % slug)
|
||||
raise Http404(_("Slug %r isn't registered.") % slug)
|
||||
|
||||
instance = f()
|
||||
instance.feed_url = getattr(f, 'feed_url', None) or request.path
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import unicode_literals
|
||||
import re
|
||||
from datetime import date, datetime, timedelta
|
||||
|
||||
|
@ -23,8 +24,8 @@ def ordinal(value):
|
|||
return value
|
||||
suffixes = (_('th'), _('st'), _('nd'), _('rd'), _('th'), _('th'), _('th'), _('th'), _('th'), _('th'))
|
||||
if value % 100 in (11, 12, 13): # special case
|
||||
return u"%d%s" % (value, suffixes[0])
|
||||
return u"%d%s" % (value, suffixes[value % 10])
|
||||
return "%d%s" % (value, suffixes[0])
|
||||
return "%d%s" % (value, suffixes[value % 10])
|
||||
|
||||
@register.filter(is_safe=True)
|
||||
def intcomma(value, use_l10n=True):
|
||||
|
@ -161,11 +162,11 @@ def naturalday(value, arg=None):
|
|||
today = datetime.now(tzinfo).date()
|
||||
delta = value - today
|
||||
if delta.days == 0:
|
||||
return _(u'today')
|
||||
return _('today')
|
||||
elif delta.days == 1:
|
||||
return _(u'tomorrow')
|
||||
return _('tomorrow')
|
||||
elif delta.days == -1:
|
||||
return _(u'yesterday')
|
||||
return _('yesterday')
|
||||
return defaultfilters.date(value, arg)
|
||||
|
||||
@register.filter
|
||||
|
@ -185,20 +186,20 @@ def naturaltime(value):
|
|||
'naturaltime', '%(delta)s ago'
|
||||
) % {'delta': defaultfilters.timesince(value)}
|
||||
elif delta.seconds == 0:
|
||||
return _(u'now')
|
||||
return _('now')
|
||||
elif delta.seconds < 60:
|
||||
return ungettext(
|
||||
u'a second ago', u'%(count)s seconds ago', delta.seconds
|
||||
'a second ago', '%(count)s seconds ago', delta.seconds
|
||||
) % {'count': delta.seconds}
|
||||
elif delta.seconds // 60 < 60:
|
||||
count = delta.seconds // 60
|
||||
return ungettext(
|
||||
u'a minute ago', u'%(count)s minutes ago', count
|
||||
'a minute ago', '%(count)s minutes ago', count
|
||||
) % {'count': count}
|
||||
else:
|
||||
count = delta.seconds // 60 // 60
|
||||
return ungettext(
|
||||
u'an hour ago', u'%(count)s hours ago', count
|
||||
'an hour ago', '%(count)s hours ago', count
|
||||
) % {'count': count}
|
||||
else:
|
||||
delta = value - now
|
||||
|
@ -207,18 +208,18 @@ def naturaltime(value):
|
|||
'naturaltime', '%(delta)s from now'
|
||||
) % {'delta': defaultfilters.timeuntil(value)}
|
||||
elif delta.seconds == 0:
|
||||
return _(u'now')
|
||||
return _('now')
|
||||
elif delta.seconds < 60:
|
||||
return ungettext(
|
||||
u'a second from now', u'%(count)s seconds from now', delta.seconds
|
||||
'a second from now', '%(count)s seconds from now', delta.seconds
|
||||
) % {'count': delta.seconds}
|
||||
elif delta.seconds // 60 < 60:
|
||||
count = delta.seconds // 60
|
||||
return ungettext(
|
||||
u'a minute from now', u'%(count)s minutes from now', count
|
||||
'a minute from now', '%(count)s minutes from now', count
|
||||
) % {'count': count}
|
||||
else:
|
||||
count = delta.seconds // 60 // 60
|
||||
return ungettext(
|
||||
u'an hour from now', u'%(count)s hours from now', count
|
||||
'an hour from now', '%(count)s hours from now', count
|
||||
) % {'count': count}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import unicode_literals
|
||||
import datetime
|
||||
import new
|
||||
|
||||
|
@ -89,8 +90,8 @@ class HumanizeTests(TestCase):
|
|||
def test_apnumber(self):
|
||||
test_list = [str(x) for x in range(1, 11)]
|
||||
test_list.append(None)
|
||||
result_list = (u'one', u'two', u'three', u'four', u'five', u'six',
|
||||
u'seven', u'eight', u'nine', u'10', None)
|
||||
result_list = ('one', 'two', 'three', 'four', 'five', 'six',
|
||||
'seven', 'eight', 'nine', '10', None)
|
||||
|
||||
self.humanize_tester(test_list, result_list, 'apnumber')
|
||||
|
||||
|
@ -99,12 +100,12 @@ class HumanizeTests(TestCase):
|
|||
yesterday = today - datetime.timedelta(days=1)
|
||||
tomorrow = today + datetime.timedelta(days=1)
|
||||
someday = today - datetime.timedelta(days=10)
|
||||
notdate = u"I'm not a date value"
|
||||
notdate = "I'm not a date value"
|
||||
|
||||
test_list = (today, yesterday, tomorrow, someday, notdate, None)
|
||||
someday_result = defaultfilters.date(someday)
|
||||
result_list = (_(u'today'), _(u'yesterday'), _(u'tomorrow'),
|
||||
someday_result, u"I'm not a date value", None)
|
||||
result_list = (_('today'), _('yesterday'), _('tomorrow'),
|
||||
someday_result, "I'm not a date value", None)
|
||||
self.humanize_tester(test_list, result_list, 'naturalday')
|
||||
|
||||
def test_naturalday_tz(self):
|
||||
|
|
|
@ -7,30 +7,31 @@ http://www.argentina.gov.ar/argentina/portal/paginas.dhtml?pagina=425
|
|||
This exists in this standalone file so that it's only imported into memory
|
||||
when explicitly needed.
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
PROVINCE_CHOICES = (
|
||||
('B', u'Buenos Aires'),
|
||||
('K', u'Catamarca'),
|
||||
('H', u'Chaco'),
|
||||
('U', u'Chubut'),
|
||||
('C', u'Ciudad Autónoma de Buenos Aires'),
|
||||
('X', u'Córdoba'),
|
||||
('W', u'Corrientes'),
|
||||
('E', u'Entre Ríos'),
|
||||
('P', u'Formosa'),
|
||||
('Y', u'Jujuy'),
|
||||
('L', u'La Pampa'),
|
||||
('F', u'La Rioja'),
|
||||
('M', u'Mendoza'),
|
||||
('N', u'Misiones'),
|
||||
('Q', u'Neuquén'),
|
||||
('R', u'Río Negro'),
|
||||
('A', u'Salta'),
|
||||
('J', u'San Juan'),
|
||||
('D', u'San Luis'),
|
||||
('Z', u'Santa Cruz'),
|
||||
('S', u'Santa Fe'),
|
||||
('G', u'Santiago del Estero'),
|
||||
('V', u'Tierra del Fuego, Antártida e Islas del Atlántico Sur'),
|
||||
('T', u'Tucumán'),
|
||||
('B', 'Buenos Aires'),
|
||||
('K', 'Catamarca'),
|
||||
('H', 'Chaco'),
|
||||
('U', 'Chubut'),
|
||||
('C', 'Ciudad Autónoma de Buenos Aires'),
|
||||
('X', 'Córdoba'),
|
||||
('W', 'Corrientes'),
|
||||
('E', 'Entre Ríos'),
|
||||
('P', 'Formosa'),
|
||||
('Y', 'Jujuy'),
|
||||
('L', 'La Pampa'),
|
||||
('F', 'La Rioja'),
|
||||
('M', 'Mendoza'),
|
||||
('N', 'Misiones'),
|
||||
('Q', 'Neuquén'),
|
||||
('R', 'Río Negro'),
|
||||
('A', 'Salta'),
|
||||
('J', 'San Juan'),
|
||||
('D', 'San Luis'),
|
||||
('Z', 'Santa Cruz'),
|
||||
('S', 'Santa Fe'),
|
||||
('G', 'Santiago del Estero'),
|
||||
('V', 'Tierra del Fuego, Antártida e Islas del Atlántico Sur'),
|
||||
('T', 'Tucumán'),
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
AR-specific Form helpers.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django.contrib.localflavor.ar.ar_provinces import PROVINCE_CHOICES
|
||||
from django.core.validators import EMPTY_VALUES
|
||||
|
@ -37,11 +37,11 @@ class ARPostalCodeField(RegexField):
|
|||
def clean(self, value):
|
||||
value = super(ARPostalCodeField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
if len(value) not in (4, 8):
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
if len(value) == 8:
|
||||
return u'%s%s%s' % (value[0].upper(), value[1:5], value[5:].upper())
|
||||
return '%s%s%s' % (value[0].upper(), value[1:5], value[5:].upper())
|
||||
return value
|
||||
|
||||
class ARDNIField(CharField):
|
||||
|
@ -63,7 +63,7 @@ class ARDNIField(CharField):
|
|||
"""
|
||||
value = super(ARDNIField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
if not value.isdigit():
|
||||
value = value.replace('.', '')
|
||||
if not value.isdigit():
|
||||
|
@ -94,7 +94,7 @@ class ARCUITField(RegexField):
|
|||
"""
|
||||
value = super(ARCUITField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
value, cd = self._canon(value)
|
||||
if self._calc_cd(value) != cd:
|
||||
raise ValidationError(self.error_messages['checksum'])
|
||||
|
@ -113,5 +113,5 @@ class ARCUITField(RegexField):
|
|||
if check_digit == None:
|
||||
check_digit = cuit[-1]
|
||||
cuit = cuit[:-1]
|
||||
return u'%s-%s-%s' % (cuit[:2], cuit[2:], check_digit)
|
||||
return '%s-%s-%s' % (cuit[:2], cuit[2:], check_digit)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
AT-specific Form helpers
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import re
|
||||
|
||||
from django.core.validators import EMPTY_VALUES
|
||||
|
@ -47,13 +47,13 @@ class ATSocialSecurityNumberField(Field):
|
|||
"""
|
||||
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.'),
|
||||
'invalid': _('Enter a valid Austrian Social Security Number in XXXX XXXXXX format.'),
|
||||
}
|
||||
|
||||
def clean(self, value):
|
||||
value = super(ATSocialSecurityNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u""
|
||||
return ""
|
||||
if not re_ssn.search(value):
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
sqnr, date = value.split(" ")
|
||||
|
@ -66,4 +66,4 @@ class ATSocialSecurityNumberField(Field):
|
|||
res = res % 11
|
||||
if res != int(check):
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
return u'%s%s %s'%(sqnr, check, date,)
|
||||
return '%s%s %s'%(sqnr, check, date,)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Australian-specific Form helpers
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
|
@ -34,7 +34,7 @@ class AUPostCodeField(RegexField):
|
|||
class AUPhoneNumberField(Field):
|
||||
"""Australian phone number field."""
|
||||
default_error_messages = {
|
||||
'invalid': u'Phone numbers must contain 10 digits.',
|
||||
'invalid': 'Phone numbers must contain 10 digits.',
|
||||
}
|
||||
|
||||
def clean(self, value):
|
||||
|
@ -43,11 +43,11 @@ class AUPhoneNumberField(Field):
|
|||
"""
|
||||
super(AUPhoneNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
value = re.sub('(\(|\)|\s+|-)', '', smart_unicode(value))
|
||||
phone_match = PHONE_DIGITS_RE.search(value)
|
||||
if phone_match:
|
||||
return u'%s' % phone_match.group(1)
|
||||
return '%s' % phone_match.group(1)
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
||||
|
||||
|
|
|
@ -5,33 +5,34 @@ An alphabetical list of Brazilian states for use as `choices` in a formfield.
|
|||
This exists in this standalone file so that it's only imported into memory
|
||||
when explicitly needed.
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
STATE_CHOICES = (
|
||||
('AC', 'Acre'),
|
||||
('AL', 'Alagoas'),
|
||||
('AP', u'Amapá'),
|
||||
('AP', 'Amapá'),
|
||||
('AM', 'Amazonas'),
|
||||
('BA', 'Bahia'),
|
||||
('CE', u'Ceará'),
|
||||
('CE', 'Ceará'),
|
||||
('DF', 'Distrito Federal'),
|
||||
('ES', u'Espírito Santo'),
|
||||
('GO', u'Goiás'),
|
||||
('MA', u'Maranhão'),
|
||||
('ES', 'Espírito Santo'),
|
||||
('GO', 'Goiás'),
|
||||
('MA', 'Maranhão'),
|
||||
('MT', 'Mato Grosso'),
|
||||
('MS', 'Mato Grosso do Sul'),
|
||||
('MG', 'Minas Gerais'),
|
||||
('PA', u'Pará'),
|
||||
('PB', u'Paraíba'),
|
||||
('PR', u'Paraná'),
|
||||
('PA', 'Pará'),
|
||||
('PB', 'Paraíba'),
|
||||
('PR', 'Paraná'),
|
||||
('PE', 'Pernambuco'),
|
||||
('PI', u'Piauí'),
|
||||
('PI', 'Piauí'),
|
||||
('RJ', 'Rio de Janeiro'),
|
||||
('RN', 'Rio Grande do Norte'),
|
||||
('RS', 'Rio Grande do Sul'),
|
||||
('RO', u'Rondônia'),
|
||||
('RO', 'Rondônia'),
|
||||
('RR', 'Roraima'),
|
||||
('SC', 'Santa Catarina'),
|
||||
('SP', u'São Paulo'),
|
||||
('SP', 'São Paulo'),
|
||||
('SE', 'Sergipe'),
|
||||
('TO', 'Tocantins'),
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
BR-specific Form helpers
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
|
@ -34,11 +34,11 @@ class BRPhoneNumberField(Field):
|
|||
def clean(self, value):
|
||||
super(BRPhoneNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
value = re.sub('(\(|\)|\s+)', '', smart_unicode(value))
|
||||
m = phone_digits_re.search(value)
|
||||
if m:
|
||||
return u'%s-%s-%s' % (m.group(1), m.group(2), m.group(3))
|
||||
return '%s-%s-%s' % (m.group(1), m.group(2), m.group(3))
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
||||
class BRStateSelect(Select):
|
||||
|
@ -55,7 +55,7 @@ class BRStateChoiceField(Field):
|
|||
"""
|
||||
widget = Select
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Select a valid brazilian state. That state is not one of the available states.'),
|
||||
'invalid': _('Select a valid brazilian state. That state is not one of the available states.'),
|
||||
}
|
||||
|
||||
def __init__(self, required=True, widget=None, label=None,
|
||||
|
@ -67,9 +67,9 @@ class BRStateChoiceField(Field):
|
|||
def clean(self, value):
|
||||
value = super(BRStateChoiceField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
value = u''
|
||||
value = ''
|
||||
value = smart_unicode(value)
|
||||
if value == u'':
|
||||
if value == '':
|
||||
return value
|
||||
valid_values = set([smart_unicode(k) for k, v in self.widget.choices])
|
||||
if value not in valid_values:
|
||||
|
@ -105,7 +105,7 @@ class BRCPFField(CharField):
|
|||
"""
|
||||
value = super(BRCPFField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
orig_value = value[:]
|
||||
if not value.isdigit():
|
||||
value = re.sub("[-\.]", "", value)
|
||||
|
@ -142,7 +142,7 @@ class BRCNPJField(Field):
|
|||
"""
|
||||
value = super(BRCNPJField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
orig_value = value[:]
|
||||
if not value.isdigit():
|
||||
value = re.sub("[-/\.]", "", value)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Canada-specific Form helpers
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
|
@ -26,7 +26,7 @@ class CAPostalCodeField(CharField):
|
|||
http://www.canadapost.ca/tools/pg/manual/PGaddress-e.asp#1402170
|
||||
"""
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Enter a postal code in the format XXX XXX.'),
|
||||
'invalid': _('Enter a postal code in the format XXX XXX.'),
|
||||
}
|
||||
|
||||
postcode_regex = re.compile(r'^([ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ]) *(\d[ABCEGHJKLMNPRSTVWXYZ]\d)$')
|
||||
|
@ -34,7 +34,7 @@ class CAPostalCodeField(CharField):
|
|||
def clean(self, value):
|
||||
value = super(CAPostalCodeField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
postcode = value.upper().strip()
|
||||
m = self.postcode_regex.match(postcode)
|
||||
if not m:
|
||||
|
@ -44,7 +44,7 @@ class CAPostalCodeField(CharField):
|
|||
class CAPhoneNumberField(Field):
|
||||
"""Canadian phone number field."""
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Phone numbers must be in XXX-XXX-XXXX format.'),
|
||||
'invalid': _('Phone numbers must be in XXX-XXX-XXXX format.'),
|
||||
}
|
||||
|
||||
def clean(self, value):
|
||||
|
@ -52,11 +52,11 @@ class CAPhoneNumberField(Field):
|
|||
"""
|
||||
super(CAPhoneNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
value = re.sub('(\(|\)|\s+)', '', smart_unicode(value))
|
||||
m = phone_digits_re.search(value)
|
||||
if m:
|
||||
return u'%s-%s-%s' % (m.group(1), m.group(2), m.group(3))
|
||||
return '%s-%s-%s' % (m.group(1), m.group(2), m.group(3))
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
||||
class CAProvinceField(Field):
|
||||
|
@ -66,13 +66,13 @@ class CAProvinceField(Field):
|
|||
abbreviation for the given province.
|
||||
"""
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Enter a Canadian province or territory.'),
|
||||
'invalid': _('Enter a Canadian province or territory.'),
|
||||
}
|
||||
|
||||
def clean(self, value):
|
||||
super(CAProvinceField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
try:
|
||||
value = value.strip().lower()
|
||||
except AttributeError:
|
||||
|
@ -113,14 +113,14 @@ class CASocialInsuranceNumberField(Field):
|
|||
def clean(self, value):
|
||||
super(CASocialInsuranceNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
match = re.match(sin_re, value)
|
||||
if not match:
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
||||
number = u'%s-%s-%s' % (match.group(1), match.group(2), match.group(3))
|
||||
check_number = u'%s%s%s' % (match.group(1), match.group(2), match.group(3))
|
||||
number = '%s-%s-%s' % (match.group(1), match.group(2), match.group(3))
|
||||
check_number = '%s%s%s' % (match.group(1), match.group(2), match.group(3))
|
||||
if not self.luhn_checksum_is_valid(check_number):
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
return number
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Swiss-specific Form helpers
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
|
@ -40,11 +40,11 @@ class CHPhoneNumberField(Field):
|
|||
def clean(self, value):
|
||||
super(CHPhoneNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
value = re.sub('(\.|\s|/|-)', '', smart_unicode(value))
|
||||
m = phone_digits_re.search(value)
|
||||
if m:
|
||||
return u'%s %s %s %s' % (value[0:3], value[3:6], value[6:8], value[8:10])
|
||||
return '%s %s %s %s' % (value[0:3], value[3:6], value[6:8], value[8:10])
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
||||
class CHStateSelect(Select):
|
||||
|
@ -102,7 +102,7 @@ class CHIdentityCardNumberField(Field):
|
|||
def clean(self, value):
|
||||
super(CHIdentityCardNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
match = re.match(id_re, value)
|
||||
if not match:
|
||||
|
@ -118,5 +118,5 @@ class CHIdentityCardNumberField(Field):
|
|||
if not self.has_valid_checksum(all_digits):
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
||||
return u'%s%s%s' % (idnumber, pos9, checksum)
|
||||
return '%s%s%s' % (idnumber, pos9, checksum)
|
||||
|
||||
|
|
|
@ -5,21 +5,22 @@ A list of Chilean regions as `choices` in a formfield.
|
|||
This exists in this standalone file so that it's only imported into memory
|
||||
when explicitly needed.
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
REGION_CHOICES = (
|
||||
('RM', u'Región Metropolitana de Santiago'),
|
||||
('I', u'Región de Tarapacá'),
|
||||
('II', u'Región de Antofagasta'),
|
||||
('III', u'Región de Atacama'),
|
||||
('IV', u'Región de Coquimbo'),
|
||||
('V', u'Región de Valparaíso'),
|
||||
('VI', u'Región del Libertador Bernardo O\'Higgins'),
|
||||
('VII', u'Región del Maule'),
|
||||
('VIII',u'Región del Bío Bío'),
|
||||
('IX', u'Región de la Araucanía'),
|
||||
('X', u'Región de los Lagos'),
|
||||
('XI', u'Región de Aysén del General Carlos Ibáñez del Campo'),
|
||||
('XII', u'Región de Magallanes y la Antártica Chilena'),
|
||||
('XIV', u'Región de Los Ríos'),
|
||||
('XV', u'Región de Arica-Parinacota'),
|
||||
('RM', 'Región Metropolitana de Santiago'),
|
||||
('I', 'Región de Tarapacá'),
|
||||
('II', 'Región de Antofagasta'),
|
||||
('III', 'Región de Atacama'),
|
||||
('IV', 'Región de Coquimbo'),
|
||||
('V', 'Región de Valparaíso'),
|
||||
('VI', 'Región del Libertador Bernardo O\'Higgins'),
|
||||
('VII', 'Región del Maule'),
|
||||
('VIII','Región del Bío Bío'),
|
||||
('IX', 'Región de la Araucanía'),
|
||||
('X', 'Región de los Lagos'),
|
||||
('XI', 'Región de Aysén del General Carlos Ibáñez del Campo'),
|
||||
('XII', 'Región de Magallanes y la Antártica Chilena'),
|
||||
('XIV', 'Región de Los Ríos'),
|
||||
('XV', 'Región de Arica-Parinacota'),
|
||||
)
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
Chile specific form helpers.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django.contrib.localflavor.cl.cl_regions import REGION_CHOICES
|
||||
from django.core.validators import EMPTY_VALUES
|
||||
from django.forms import ValidationError
|
||||
from django.forms.fields import RegexField, Select
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.encoding import smart_unicode
|
||||
|
||||
from .cl_regions import REGION_CHOICES
|
||||
|
||||
class CLRegionSelect(Select):
|
||||
"""
|
||||
|
@ -50,7 +50,7 @@ class CLRutField(RegexField):
|
|||
"""
|
||||
super(CLRutField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
rut, verificador = self._canonify(value)
|
||||
if self._algorithm(rut) == verificador:
|
||||
return self._format(rut, verificador)
|
||||
|
@ -68,7 +68,7 @@ class CLRutField(RegexField):
|
|||
multi += 1
|
||||
if multi == 8:
|
||||
multi = 2
|
||||
return u'0123456789K0'[11 - suma % 11]
|
||||
return '0123456789K0'[11 - suma % 11]
|
||||
|
||||
def _canonify(self, rut):
|
||||
"""
|
||||
|
@ -93,5 +93,5 @@ class CLRutField(RegexField):
|
|||
else:
|
||||
new_dot = pos - 3
|
||||
code = code[:new_dot] + '.' + code[new_dot:]
|
||||
return u'%s-%s' % (code, verifier)
|
||||
return '%s-%s' % (code, verifier)
|
||||
|
||||
|
|
|
@ -9,41 +9,41 @@ http://en.wikipedia.org/wiki/Province_%28China%29
|
|||
http://en.wikipedia.org/wiki/Direct-controlled_municipality
|
||||
http://en.wikipedia.org/wiki/Autonomous_regions_of_China
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
CN_PROVINCE_CHOICES = (
|
||||
("anhui", u"安徽"),
|
||||
("beijing", u"北京"),
|
||||
("chongqing", u"重庆"),
|
||||
("fujian", u"福建"),
|
||||
("gansu", u"甘肃"),
|
||||
("guangdong", u"广东"),
|
||||
("guangxi", u"广西壮族自治区"),
|
||||
("guizhou", u"贵州"),
|
||||
("hainan", u"海南"),
|
||||
("hebei", u"河北"),
|
||||
("heilongjiang", u"黑龙江"),
|
||||
("henan", u"河南"),
|
||||
("hongkong", u"香港"),
|
||||
("hubei", u"湖北"),
|
||||
("hunan", u"湖南"),
|
||||
("jiangsu", u"江苏"),
|
||||
("jiangxi", u"江西"),
|
||||
("jilin", u"吉林"),
|
||||
("liaoning", u"辽宁"),
|
||||
("macao", u"澳门"),
|
||||
("neimongol", u"内蒙古自治区"),
|
||||
("ningxia", u"宁夏回族自治区"),
|
||||
("qinghai", u"青海"),
|
||||
("shaanxi", u"陕西"),
|
||||
("shandong", u"山东"),
|
||||
("shanghai", u"上海"),
|
||||
("shanxi", u"山西"),
|
||||
("sichuan", u"四川"),
|
||||
("taiwan", u"台湾"),
|
||||
("tianjin", u"天津"),
|
||||
("xinjiang", u"新疆维吾尔自治区"),
|
||||
("xizang", u"西藏自治区"),
|
||||
("yunnan", u"云南"),
|
||||
("zhejiang", u"浙江"),
|
||||
("anhui", "安徽"),
|
||||
("beijing", "北京"),
|
||||
("chongqing", "重庆"),
|
||||
("fujian", "福建"),
|
||||
("gansu", "甘肃"),
|
||||
("guangdong", "广东"),
|
||||
("guangxi", "广西壮族自治区"),
|
||||
("guizhou", "贵州"),
|
||||
("hainan", "海南"),
|
||||
("hebei", "河北"),
|
||||
("heilongjiang", "黑龙江"),
|
||||
("henan", "河南"),
|
||||
("hongkong", "香港"),
|
||||
("hubei", "湖北"),
|
||||
("hunan", "湖南"),
|
||||
("jiangsu", "江苏"),
|
||||
("jiangxi", "江西"),
|
||||
("jilin", "吉林"),
|
||||
("liaoning", "辽宁"),
|
||||
("macao", "澳门"),
|
||||
("neimongol", "内蒙古自治区"),
|
||||
("ningxia", "宁夏回族自治区"),
|
||||
("qinghai", "青海"),
|
||||
("shaanxi", "陕西"),
|
||||
("shandong", "山东"),
|
||||
("shanghai", "上海"),
|
||||
("shanxi", "山西"),
|
||||
("sichuan", "四川"),
|
||||
("taiwan", "台湾"),
|
||||
("tianjin", "天津"),
|
||||
("xinjiang", "新疆维吾尔自治区"),
|
||||
("xizang", "西藏自治区"),
|
||||
("yunnan", "云南"),
|
||||
("zhejiang", "浙江"),
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"""
|
||||
Chinese-specific form helpers
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
|
@ -81,7 +81,7 @@ class CNPostCodeField(RegexField):
|
|||
Valid code is XXXXXX where X is digit.
|
||||
"""
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Enter a post code in the format XXXXXX.'),
|
||||
'invalid': _('Enter a post code in the format XXXXXX.'),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -102,10 +102,10 @@ class CNIDCardField(CharField):
|
|||
The checksum algorithm is described in GB11643-1999.
|
||||
"""
|
||||
default_error_messages = {
|
||||
'invalid': _(u'ID Card Number consists of 15 or 18 digits.'),
|
||||
'checksum': _(u'Invalid ID Card Number: Wrong checksum'),
|
||||
'birthday': _(u'Invalid ID Card Number: Wrong birthdate'),
|
||||
'location': _(u'Invalid ID Card Number: Wrong location code'),
|
||||
'invalid': _('ID Card Number consists of 15 or 18 digits.'),
|
||||
'checksum': _('Invalid ID Card Number: Wrong checksum'),
|
||||
'birthday': _('Invalid ID Card Number: Wrong birthdate'),
|
||||
'location': _('Invalid ID Card Number: Wrong location code'),
|
||||
}
|
||||
|
||||
def __init__(self, max_length=18, min_length=15, *args, **kwargs):
|
||||
|
@ -119,7 +119,7 @@ class CNIDCardField(CharField):
|
|||
# Check the length of the ID card number.
|
||||
super(CNIDCardField, self).clean(value)
|
||||
if not value:
|
||||
return u""
|
||||
return ""
|
||||
# Check whether this ID card number has valid format
|
||||
if not re.match(ID_CARD_RE, value):
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
@ -133,7 +133,7 @@ class CNIDCardField(CharField):
|
|||
value = value.upper()
|
||||
if not self.has_valid_checksum(value):
|
||||
raise ValidationError(self.error_messages['checksum'])
|
||||
return u'%s' % value
|
||||
return '%s' % value
|
||||
|
||||
def has_valid_birthday(self, value):
|
||||
"""
|
||||
|
@ -190,7 +190,7 @@ class CNPhoneNumberField(RegexField):
|
|||
010-55555555-35
|
||||
"""
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Enter a valid phone number.'),
|
||||
'invalid': _('Enter a valid phone number.'),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -207,7 +207,7 @@ class CNCellNumberField(RegexField):
|
|||
The length of the cell number should be 11.
|
||||
"""
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Enter a valid cell number.'),
|
||||
'invalid': _('Enter a valid cell number.'),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
|
@ -6,39 +6,40 @@ formfield.
|
|||
This exists in this standalone file so that it's only
|
||||
imported into memory when explicitly needed.
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
DEPARTMENT_CHOICES = (
|
||||
('AMA', u'Amazonas'),
|
||||
('ANT', u'Antioquia'),
|
||||
('ARA', u'Arauca'),
|
||||
('ATL', u'Atlántico'),
|
||||
('DC', u'Bogotá'),
|
||||
('BOL', u'Bolívar'),
|
||||
('BOY', u'Boyacá'),
|
||||
('CAL', u'Caldas'),
|
||||
('CAQ', u'Caquetá'),
|
||||
('CAS', u'Casanare'),
|
||||
('CAU', u'Cauca'),
|
||||
('CES', u'Cesar'),
|
||||
('CHO', u'Chocó'),
|
||||
('COR', u'Córdoba'),
|
||||
('CUN', u'Cundinamarca'),
|
||||
('GUA', u'Guainía'),
|
||||
('GUV', u'Guaviare'),
|
||||
('HUI', u'Huila'),
|
||||
('LAG', u'La Guajira'),
|
||||
('MAG', u'Magdalena'),
|
||||
('MET', u'Meta'),
|
||||
('NAR', u'Nariño'),
|
||||
('NSA', u'Norte de Santander'),
|
||||
('PUT', u'Putumayo'),
|
||||
('QUI', u'Quindío'),
|
||||
('RIS', u'Risaralda'),
|
||||
('SAP', u'San Andrés and Providencia'),
|
||||
('SAN', u'Santander'),
|
||||
('SUC', u'Sucre'),
|
||||
('TOL', u'Tolima'),
|
||||
('VAC', u'Valle del Cauca'),
|
||||
('VAU', u'Vaupés'),
|
||||
('VID', u'Vichada'),
|
||||
('AMA', 'Amazonas'),
|
||||
('ANT', 'Antioquia'),
|
||||
('ARA', 'Arauca'),
|
||||
('ATL', 'Atlántico'),
|
||||
('DC', 'Bogotá'),
|
||||
('BOL', 'Bolívar'),
|
||||
('BOY', 'Boyacá'),
|
||||
('CAL', 'Caldas'),
|
||||
('CAQ', 'Caquetá'),
|
||||
('CAS', 'Casanare'),
|
||||
('CAU', 'Cauca'),
|
||||
('CES', 'Cesar'),
|
||||
('CHO', 'Chocó'),
|
||||
('COR', 'Córdoba'),
|
||||
('CUN', 'Cundinamarca'),
|
||||
('GUA', 'Guainía'),
|
||||
('GUV', 'Guaviare'),
|
||||
('HUI', 'Huila'),
|
||||
('LAG', 'La Guajira'),
|
||||
('MAG', 'Magdalena'),
|
||||
('MET', 'Meta'),
|
||||
('NAR', 'Nariño'),
|
||||
('NSA', 'Norte de Santander'),
|
||||
('PUT', 'Putumayo'),
|
||||
('QUI', 'Quindío'),
|
||||
('RIS', 'Risaralda'),
|
||||
('SAP', 'San Andrés and Providencia'),
|
||||
('SAN', 'Santander'),
|
||||
('SUC', 'Sucre'),
|
||||
('TOL', 'Tolima'),
|
||||
('VAC', 'Valle del Cauca'),
|
||||
('VAU', 'Vaupés'),
|
||||
('VID', 'Vichada'),
|
||||
)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Czech-specific form helpers
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
|
@ -29,7 +29,7 @@ class CZPostalCodeField(RegexField):
|
|||
Valid form is XXXXX or XXX XX, where X represents integer.
|
||||
"""
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Enter a postal code in the format XXXXX or XXX XX.'),
|
||||
'invalid': _('Enter a postal code in the format XXXXX or XXX XX.'),
|
||||
}
|
||||
|
||||
def __init__(self, max_length=None, min_length=None, *args, **kwargs):
|
||||
|
@ -49,15 +49,15 @@ class CZBirthNumberField(Field):
|
|||
Czech birth number field.
|
||||
"""
|
||||
default_error_messages = {
|
||||
'invalid_format': _(u'Enter a birth number in the format XXXXXX/XXXX or XXXXXXXXXX.'),
|
||||
'invalid': _(u'Enter a valid birth number.'),
|
||||
'invalid_format': _('Enter a birth number in the format XXXXXX/XXXX or XXXXXXXXXX.'),
|
||||
'invalid': _('Enter a valid birth number.'),
|
||||
}
|
||||
|
||||
def clean(self, value, gender=None):
|
||||
super(CZBirthNumberField, self).clean(value)
|
||||
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
match = re.match(birth_number, value)
|
||||
if not match:
|
||||
|
@ -67,7 +67,7 @@ class CZBirthNumberField(Field):
|
|||
|
||||
# Three digits for verification number were used until 1. january 1954
|
||||
if len(id) == 3:
|
||||
return u'%s' % value
|
||||
return '%s' % value
|
||||
|
||||
# Birth number is in format YYMMDD. Females have month value raised by 50.
|
||||
# In case that all possible number are already used (for given date),
|
||||
|
@ -90,7 +90,7 @@ class CZBirthNumberField(Field):
|
|||
modulo = int(birth + id[:3]) % 11
|
||||
|
||||
if (modulo == int(id[-1])) or (modulo == 10 and id[-1] == '0'):
|
||||
return u'%s' % value
|
||||
return '%s' % value
|
||||
else:
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
||||
|
@ -99,14 +99,14 @@ class CZICNumberField(Field):
|
|||
Czech IC number field.
|
||||
"""
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Enter a valid IC number.'),
|
||||
'invalid': _('Enter a valid IC number.'),
|
||||
}
|
||||
|
||||
def clean(self, value):
|
||||
super(CZICNumberField, self).clean(value)
|
||||
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
match = re.match(ic_number, value)
|
||||
if not match:
|
||||
|
@ -130,7 +130,7 @@ class CZICNumberField(Field):
|
|||
if (not remainder % 10 and check == 1) or \
|
||||
(remainder == 1 and check == 0) or \
|
||||
(check == (11 - remainder)):
|
||||
return u'%s' % value
|
||||
return '%s' % value
|
||||
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
DE-specific Form helpers
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
|
@ -68,7 +68,7 @@ class DEIdentityCardNumberField(Field):
|
|||
def clean(self, value):
|
||||
super(DEIdentityCardNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
match = re.match(id_re, value)
|
||||
if not match:
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
@ -80,9 +80,9 @@ class DEIdentityCardNumberField(Field):
|
|||
if residence == '0000000000' or birthday == '0000000' or validity == '0000000':
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
||||
all_digits = u"%s%s%s%s" % (residence, birthday, validity, checksum)
|
||||
all_digits = "%s%s%s%s" % (residence, birthday, validity, checksum)
|
||||
if not self.has_valid_checksum(residence) or not self.has_valid_checksum(birthday) or \
|
||||
not self.has_valid_checksum(validity) or not self.has_valid_checksum(all_digits):
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
||||
return u'%s%s-%s-%s-%s' % (residence, origin, birthday, validity, checksum)
|
||||
return '%s%s-%s-%s-%s' % (residence, origin, birthday, validity, checksum)
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
from __future__ import unicode_literals
|
||||
|
||||
DATE_FORMAT = 'j. F Y'
|
||||
TIME_FORMAT = 'H:i:s'
|
||||
DATETIME_FORMAT = 'j. F Y H:i:s'
|
||||
|
@ -39,5 +41,5 @@ DATETIME_INPUT_FORMATS = (
|
|||
# For details, please refer to http://www.bk.admin.ch/dokumentation/sprachen/04915/05016/index.html?lang=de
|
||||
# (in German) and the documentation
|
||||
DECIMAL_SEPARATOR = ','
|
||||
THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
|
||||
THOUSAND_SEPARATOR = '\xa0' # non-breaking space
|
||||
NUMBER_GROUPING = 3
|
||||
|
|
|
@ -6,30 +6,31 @@ formfield.
|
|||
This exists in this standalone file so that it's only
|
||||
imported into memory when explicitly needed.
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
PROVINCE_CHOICES = (
|
||||
('A', u'Azuay'),
|
||||
('B', u'Bolívar'),
|
||||
('F', u'Cañar'),
|
||||
('C', u'Carchi'),
|
||||
('H', u'Chimborazo'),
|
||||
('X', u'Cotopaxi'),
|
||||
('O', u'El Oro'),
|
||||
('E', u'Esmeraldas'),
|
||||
('W', u'Galápagos'),
|
||||
('G', u'Guayas'),
|
||||
('I', u'Imbabura'),
|
||||
('L', u'Loja'),
|
||||
('R', u'Los Ríos'),
|
||||
('M', u'Manabí'),
|
||||
('S', u'Morona Santiago'),
|
||||
('N', u'Napo'),
|
||||
('D', u'Orellana'),
|
||||
('Y', u'Pastaza'),
|
||||
('P', u'Pichincha'),
|
||||
('SE', u'Santa Elena'),
|
||||
('SD', u'Santo Domingo de los Tsáchilas'),
|
||||
('U', u'Sucumbíos'),
|
||||
('T', u'Tungurahua'),
|
||||
('Z', u'Zamora Chinchipe'),
|
||||
('A', 'Azuay'),
|
||||
('B', 'Bolívar'),
|
||||
('F', 'Cañar'),
|
||||
('C', 'Carchi'),
|
||||
('H', 'Chimborazo'),
|
||||
('X', 'Cotopaxi'),
|
||||
('O', 'El Oro'),
|
||||
('E', 'Esmeraldas'),
|
||||
('W', 'Galápagos'),
|
||||
('G', 'Guayas'),
|
||||
('I', 'Imbabura'),
|
||||
('L', 'Loja'),
|
||||
('R', 'Los Ríos'),
|
||||
('M', 'Manabí'),
|
||||
('S', 'Morona Santiago'),
|
||||
('N', 'Napo'),
|
||||
('D', 'Orellana'),
|
||||
('Y', 'Pastaza'),
|
||||
('P', 'Pichincha'),
|
||||
('SE', 'Santa Elena'),
|
||||
('SD', 'Santo Domingo de los Tsáchilas'),
|
||||
('U', 'Sucumbíos'),
|
||||
('T', 'Tungurahua'),
|
||||
('Z', 'Zamora Chinchipe'),
|
||||
)
|
||||
|
|
|
@ -91,7 +91,7 @@ class ESIdentityCardNumberField(RegexField):
|
|||
def clean(self, value):
|
||||
super(ESIdentityCardNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
nif_get_checksum = lambda d: self.nif_control[int(d)%23]
|
||||
|
||||
value = value.upper().replace(' ', '').replace('-', '')
|
||||
|
@ -157,7 +157,7 @@ class ESCCCField(RegexField):
|
|||
def clean(self, value):
|
||||
super(ESCCCField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
control_str = [1, 2, 4, 8, 5, 10, 9, 7, 3, 6]
|
||||
m = re.match(r'^(\d{4})[ -]?(\d{4})[ -]?(\d{2})[ -]?(\d{10})$', value)
|
||||
entity, office, checksum, account = m.groups()
|
||||
|
|
|
@ -7,347 +7,349 @@ This exists in this standalone file so that it's only imported into memory
|
|||
when explicitly needed.
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
MUNICIPALITY_CHOICES = (
|
||||
('akaa', u"Akaa"),
|
||||
('alajarvi', u"Alajärvi"),
|
||||
('alavieska', u"Alavieska"),
|
||||
('alavus', u"Alavus"),
|
||||
('artjarvi', u"Artjärvi"),
|
||||
('asikkala', u"Asikkala"),
|
||||
('askola', u"Askola"),
|
||||
('aura', u"Aura"),
|
||||
('brando', u"Brändö"),
|
||||
('eckero', u"Eckerö"),
|
||||
('enonkoski', u"Enonkoski"),
|
||||
('enontekio', u"Enontekiö"),
|
||||
('espoo', u"Espoo"),
|
||||
('eura', u"Eura"),
|
||||
('eurajoki', u"Eurajoki"),
|
||||
('evijarvi', u"Evijärvi"),
|
||||
('finstrom', u"Finström"),
|
||||
('forssa', u"Forssa"),
|
||||
('foglo', u"Föglö"),
|
||||
('geta', u"Geta"),
|
||||
('haapajarvi', u"Haapajärvi"),
|
||||
('haapavesi', u"Haapavesi"),
|
||||
('hailuoto', u"Hailuoto"),
|
||||
('halsua', u"Halsua"),
|
||||
('hamina', u"Hamina"),
|
||||
('hammarland', u"Hammarland"),
|
||||
('hankasalmi', u"Hankasalmi"),
|
||||
('hanko', u"Hanko"),
|
||||
('harjavalta', u"Harjavalta"),
|
||||
('hartola', u"Hartola"),
|
||||
('hattula', u"Hattula"),
|
||||
('haukipudas', u"Haukipudas"),
|
||||
('hausjarvi', u"Hausjärvi"),
|
||||
('heinola', u"Heinola"),
|
||||
('heinavesi', u"Heinävesi"),
|
||||
('helsinki', u"Helsinki"),
|
||||
('hirvensalmi', u"Hirvensalmi"),
|
||||
('hollola', u"Hollola"),
|
||||
('honkajoki', u"Honkajoki"),
|
||||
('huittinen', u"Huittinen"),
|
||||
('humppila', u"Humppila"),
|
||||
('hyrynsalmi', u"Hyrynsalmi"),
|
||||
('hyvinkaa', u"Hyvinkää"),
|
||||
('hameenkoski', u"Hämeenkoski"),
|
||||
('hameenkyro', u"Hämeenkyrö"),
|
||||
('hameenlinna', u"Hämeenlinna"),
|
||||
('ii', u"Ii"),
|
||||
('iisalmi', u"Iisalmi"),
|
||||
('iitti', u"Iitti"),
|
||||
('ikaalinen', u"Ikaalinen"),
|
||||
('ilmajoki', u"Ilmajoki"),
|
||||
('ilomantsi', u"Ilomantsi"),
|
||||
('imatra', u"Imatra"),
|
||||
('inari', u"Inari"),
|
||||
('inkoo', u"Inkoo"),
|
||||
('isojoki', u"Isojoki"),
|
||||
('isokyro', u"Isokyrö"),
|
||||
('jalasjarvi', u"Jalasjärvi"),
|
||||
('janakkala', u"Janakkala"),
|
||||
('joensuu', u"Joensuu"),
|
||||
('jokioinen', u"Jokioinen"),
|
||||
('jomala', u"Jomala"),
|
||||
('joroinen', u"Joroinen"),
|
||||
('joutsa', u"Joutsa"),
|
||||
('juankoski', u"Juankoski"),
|
||||
('juuka', u"Juuka"),
|
||||
('juupajoki', u"Juupajoki"),
|
||||
('juva', u"Juva"),
|
||||
('jyvaskyla', u"Jyväskylä"),
|
||||
('jamijarvi', u"Jämijärvi"),
|
||||
('jamsa', u"Jämsä"),
|
||||
('jarvenpaa', u"Järvenpää"),
|
||||
('kaarina', u"Kaarina"),
|
||||
('kaavi', u"Kaavi"),
|
||||
('kajaani', u"Kajaani"),
|
||||
('kalajoki', u"Kalajoki"),
|
||||
('kangasala', u"Kangasala"),
|
||||
('kangasniemi', u"Kangasniemi"),
|
||||
('kankaanpaa', u"Kankaanpää"),
|
||||
('kannonkoski', u"Kannonkoski"),
|
||||
('kannus', u"Kannus"),
|
||||
('karijoki', u"Karijoki"),
|
||||
('karjalohja', u"Karjalohja"),
|
||||
('karkkila', u"Karkkila"),
|
||||
('karstula', u"Karstula"),
|
||||
('karttula', u"Karttula"),
|
||||
('karvia', u"Karvia"),
|
||||
('kaskinen', u"Kaskinen"),
|
||||
('kauhajoki', u"Kauhajoki"),
|
||||
('kauhava', u"Kauhava"),
|
||||
('kauniainen', u"Kauniainen"),
|
||||
('kaustinen', u"Kaustinen"),
|
||||
('keitele', u"Keitele"),
|
||||
('kemi', u"Kemi"),
|
||||
('kemijarvi', u"Kemijärvi"),
|
||||
('keminmaa', u"Keminmaa"),
|
||||
('kemionsaari', u"Kemiönsaari"),
|
||||
('kempele', u"Kempele"),
|
||||
('kerava', u"Kerava"),
|
||||
('kerimaki', u"Kerimäki"),
|
||||
('kesalahti', u"Kesälahti"),
|
||||
('keuruu', u"Keuruu"),
|
||||
('kihnio', u"Kihniö"),
|
||||
('kiikoinen', u"Kiikoinen"),
|
||||
('kiiminki', u"Kiiminki"),
|
||||
('kinnula', u"Kinnula"),
|
||||
('kirkkonummi', u"Kirkkonummi"),
|
||||
('kitee', u"Kitee"),
|
||||
('kittila', u"Kittilä"),
|
||||
('kiuruvesi', u"Kiuruvesi"),
|
||||
('kivijarvi', u"Kivijärvi"),
|
||||
('kokemaki', u"Kokemäki"),
|
||||
('kokkola', u"Kokkola"),
|
||||
('kolari', u"Kolari"),
|
||||
('konnevesi', u"Konnevesi"),
|
||||
('kontiolahti', u"Kontiolahti"),
|
||||
('korsnas', u"Korsnäs"),
|
||||
('koskitl', u"Koski Tl"),
|
||||
('kotka', u"Kotka"),
|
||||
('kouvola', u"Kouvola"),
|
||||
('kristiinankaupunki', u"Kristiinankaupunki"),
|
||||
('kruunupyy', u"Kruunupyy"),
|
||||
('kuhmalahti', u"Kuhmalahti"),
|
||||
('kuhmo', u"Kuhmo"),
|
||||
('kuhmoinen', u"Kuhmoinen"),
|
||||
('kumlinge', u"Kumlinge"),
|
||||
('kuopio', u"Kuopio"),
|
||||
('kuortane', u"Kuortane"),
|
||||
('kurikka', u"Kurikka"),
|
||||
('kustavi', u"Kustavi"),
|
||||
('kuusamo', u"Kuusamo"),
|
||||
('kylmakoski', u"Kylmäkoski"),
|
||||
('kyyjarvi', u"Kyyjärvi"),
|
||||
('karkola', u"Kärkölä"),
|
||||
('karsamaki', u"Kärsämäki"),
|
||||
('kokar', u"Kökar"),
|
||||
('koylio', u"Köyliö"),
|
||||
('lahti', u"Lahti"),
|
||||
('laihia', u"Laihia"),
|
||||
('laitila', u"Laitila"),
|
||||
('lapinjarvi', u"Lapinjärvi"),
|
||||
('lapinlahti', u"Lapinlahti"),
|
||||
('lappajarvi', u"Lappajärvi"),
|
||||
('lappeenranta', u"Lappeenranta"),
|
||||
('lapua', u"Lapua"),
|
||||
('laukaa', u"Laukaa"),
|
||||
('lavia', u"Lavia"),
|
||||
('lemi', u"Lemi"),
|
||||
('lemland', u"Lemland"),
|
||||
('lempaala', u"Lempäälä"),
|
||||
('leppavirta', u"Leppävirta"),
|
||||
('lestijarvi', u"Lestijärvi"),
|
||||
('lieksa', u"Lieksa"),
|
||||
('lieto', u"Lieto"),
|
||||
('liminka', u"Liminka"),
|
||||
('liperi', u"Liperi"),
|
||||
('lohja', u"Lohja"),
|
||||
('loimaa', u"Loimaa"),
|
||||
('loppi', u"Loppi"),
|
||||
('loviisa', u"Loviisa"),
|
||||
('luhanka', u"Luhanka"),
|
||||
('lumijoki', u"Lumijoki"),
|
||||
('lumparland', u"Lumparland"),
|
||||
('luoto', u"Luoto"),
|
||||
('luumaki', u"Luumäki"),
|
||||
('luvia', u"Luvia"),
|
||||
('lansi-turunmaa', u"Länsi-Turunmaa"),
|
||||
('maalahti', u"Maalahti"),
|
||||
('maaninka', u"Maaninka"),
|
||||
('maarianhamina', u"Maarianhamina"),
|
||||
('marttila', u"Marttila"),
|
||||
('masku', u"Masku"),
|
||||
('merijarvi', u"Merijärvi"),
|
||||
('merikarvia', u"Merikarvia"),
|
||||
('miehikkala', u"Miehikkälä"),
|
||||
('mikkeli', u"Mikkeli"),
|
||||
('muhos', u"Muhos"),
|
||||
('multia', u"Multia"),
|
||||
('muonio', u"Muonio"),
|
||||
('mustasaari', u"Mustasaari"),
|
||||
('muurame', u"Muurame"),
|
||||
('mynamaki', u"Mynämäki"),
|
||||
('myrskyla', u"Myrskylä"),
|
||||
('mantsala', u"Mäntsälä"),
|
||||
('mantta-vilppula', u"Mänttä-Vilppula"),
|
||||
('mantyharju', u"Mäntyharju"),
|
||||
('naantali', u"Naantali"),
|
||||
('nakkila', u"Nakkila"),
|
||||
('nastola', u"Nastola"),
|
||||
('nilsia', u"Nilsiä"),
|
||||
('nivala', u"Nivala"),
|
||||
('nokia', u"Nokia"),
|
||||
('nousiainen', u"Nousiainen"),
|
||||
('nummi-pusula', u"Nummi-Pusula"),
|
||||
('nurmes', u"Nurmes"),
|
||||
('nurmijarvi', u"Nurmijärvi"),
|
||||
('narpio', u"Närpiö"),
|
||||
('oravainen', u"Oravainen"),
|
||||
('orimattila', u"Orimattila"),
|
||||
('oripaa', u"Oripää"),
|
||||
('orivesi', u"Orivesi"),
|
||||
('oulainen', u"Oulainen"),
|
||||
('oulu', u"Oulu"),
|
||||
('oulunsalo', u"Oulunsalo"),
|
||||
('outokumpu', u"Outokumpu"),
|
||||
('padasjoki', u"Padasjoki"),
|
||||
('paimio', u"Paimio"),
|
||||
('paltamo', u"Paltamo"),
|
||||
('parikkala', u"Parikkala"),
|
||||
('parkano', u"Parkano"),
|
||||
('pedersore', u"Pedersöre"),
|
||||
('pelkosenniemi', u"Pelkosenniemi"),
|
||||
('pello', u"Pello"),
|
||||
('perho', u"Perho"),
|
||||
('pertunmaa', u"Pertunmaa"),
|
||||
('petajavesi', u"Petäjävesi"),
|
||||
('pieksamaki', u"Pieksämäki"),
|
||||
('pielavesi', u"Pielavesi"),
|
||||
('pietarsaari', u"Pietarsaari"),
|
||||
('pihtipudas', u"Pihtipudas"),
|
||||
('pirkkala', u"Pirkkala"),
|
||||
('polvijarvi', u"Polvijärvi"),
|
||||
('pomarkku', u"Pomarkku"),
|
||||
('pori', u"Pori"),
|
||||
('pornainen', u"Pornainen"),
|
||||
('porvoo', u"Porvoo"),
|
||||
('posio', u"Posio"),
|
||||
('pudasjarvi', u"Pudasjärvi"),
|
||||
('pukkila', u"Pukkila"),
|
||||
('punkaharju', u"Punkaharju"),
|
||||
('punkalaidun', u"Punkalaidun"),
|
||||
('puolanka', u"Puolanka"),
|
||||
('puumala', u"Puumala"),
|
||||
('pyhtaa', u"Pyhtää"),
|
||||
('pyhajoki', u"Pyhäjoki"),
|
||||
('pyhajarvi', u"Pyhäjärvi"),
|
||||
('pyhanta', u"Pyhäntä"),
|
||||
('pyharanta', u"Pyhäranta"),
|
||||
('palkane', u"Pälkäne"),
|
||||
('poytya', u"Pöytyä"),
|
||||
('raahe', u"Raahe"),
|
||||
('raasepori', u"Raasepori"),
|
||||
('raisio', u"Raisio"),
|
||||
('rantasalmi', u"Rantasalmi"),
|
||||
('ranua', u"Ranua"),
|
||||
('rauma', u"Rauma"),
|
||||
('rautalampi', u"Rautalampi"),
|
||||
('rautavaara', u"Rautavaara"),
|
||||
('rautjarvi', u"Rautjärvi"),
|
||||
('reisjarvi', u"Reisjärvi"),
|
||||
('riihimaki', u"Riihimäki"),
|
||||
('ristiina', u"Ristiina"),
|
||||
('ristijarvi', u"Ristijärvi"),
|
||||
('rovaniemi', u"Rovaniemi"),
|
||||
('ruokolahti', u"Ruokolahti"),
|
||||
('ruovesi', u"Ruovesi"),
|
||||
('rusko', u"Rusko"),
|
||||
('raakkyla', u"Rääkkylä"),
|
||||
('saarijarvi', u"Saarijärvi"),
|
||||
('salla', u"Salla"),
|
||||
('salo', u"Salo"),
|
||||
('saltvik', u"Saltvik"),
|
||||
('sastamala', u"Sastamala"),
|
||||
('sauvo', u"Sauvo"),
|
||||
('savitaipale', u"Savitaipale"),
|
||||
('savonlinna', u"Savonlinna"),
|
||||
('savukoski', u"Savukoski"),
|
||||
('seinajoki', u"Seinäjoki"),
|
||||
('sievi', u"Sievi"),
|
||||
('siikainen', u"Siikainen"),
|
||||
('siikajoki', u"Siikajoki"),
|
||||
('siikalatva', u"Siikalatva"),
|
||||
('siilinjarvi', u"Siilinjärvi"),
|
||||
('simo', u"Simo"),
|
||||
('sipoo', u"Sipoo"),
|
||||
('siuntio', u"Siuntio"),
|
||||
('sodankyla', u"Sodankylä"),
|
||||
('soini', u"Soini"),
|
||||
('somero', u"Somero"),
|
||||
('sonkajarvi', u"Sonkajärvi"),
|
||||
('sotkamo', u"Sotkamo"),
|
||||
('sottunga', u"Sottunga"),
|
||||
('sulkava', u"Sulkava"),
|
||||
('sund', u"Sund"),
|
||||
('suomenniemi', u"Suomenniemi"),
|
||||
('suomussalmi', u"Suomussalmi"),
|
||||
('suonenjoki', u"Suonenjoki"),
|
||||
('sysma', u"Sysmä"),
|
||||
('sakyla', u"Säkylä"),
|
||||
('taipalsaari', u"Taipalsaari"),
|
||||
('taivalkoski', u"Taivalkoski"),
|
||||
('taivassalo', u"Taivassalo"),
|
||||
('tammela', u"Tammela"),
|
||||
('tampere', u"Tampere"),
|
||||
('tarvasjoki', u"Tarvasjoki"),
|
||||
('tervo', u"Tervo"),
|
||||
('tervola', u"Tervola"),
|
||||
('teuva', u"Teuva"),
|
||||
('tohmajarvi', u"Tohmajärvi"),
|
||||
('toholampi', u"Toholampi"),
|
||||
('toivakka', u"Toivakka"),
|
||||
('tornio', u"Tornio"),
|
||||
('turku', u"Turku"),
|
||||
('tuusniemi', u"Tuusniemi"),
|
||||
('tuusula', u"Tuusula"),
|
||||
('tyrnava', u"Tyrnävä"),
|
||||
('toysa', u"Töysä"),
|
||||
('ulvila', u"Ulvila"),
|
||||
('urjala', u"Urjala"),
|
||||
('utajarvi', u"Utajärvi"),
|
||||
('utsjoki', u"Utsjoki"),
|
||||
('uurainen', u"Uurainen"),
|
||||
('uusikaarlepyy', u"Uusikaarlepyy"),
|
||||
('uusikaupunki', u"Uusikaupunki"),
|
||||
('vaala', u"Vaala"),
|
||||
('vaasa', u"Vaasa"),
|
||||
('valkeakoski', u"Valkeakoski"),
|
||||
('valtimo', u"Valtimo"),
|
||||
('vantaa', u"Vantaa"),
|
||||
('varkaus', u"Varkaus"),
|
||||
('varpaisjarvi', u"Varpaisjärvi"),
|
||||
('vehmaa', u"Vehmaa"),
|
||||
('vesanto', u"Vesanto"),
|
||||
('vesilahti', u"Vesilahti"),
|
||||
('veteli', u"Veteli"),
|
||||
('vierema', u"Vieremä"),
|
||||
('vihanti', u"Vihanti"),
|
||||
('vihti', u"Vihti"),
|
||||
('viitasaari', u"Viitasaari"),
|
||||
('vimpeli', u"Vimpeli"),
|
||||
('virolahti', u"Virolahti"),
|
||||
('virrat', u"Virrat"),
|
||||
('vardo', u"Vårdö"),
|
||||
('vahakyro', u"Vähäkyrö"),
|
||||
('voyri-maksamaa', u"Vöyri-Maksamaa"),
|
||||
('yli-ii', u"Yli-Ii"),
|
||||
('ylitornio', u"Ylitornio"),
|
||||
('ylivieska', u"Ylivieska"),
|
||||
('ylojarvi', u"Ylöjärvi"),
|
||||
('ypaja', u"Ypäjä"),
|
||||
('ahtari', u"Ähtäri"),
|
||||
('aanekoski', u"Äänekoski")
|
||||
)
|
||||
('akaa', "Akaa"),
|
||||
('alajarvi', "Alajärvi"),
|
||||
('alavieska', "Alavieska"),
|
||||
('alavus', "Alavus"),
|
||||
('artjarvi', "Artjärvi"),
|
||||
('asikkala', "Asikkala"),
|
||||
('askola', "Askola"),
|
||||
('aura', "Aura"),
|
||||
('brando', "Brändö"),
|
||||
('eckero', "Eckerö"),
|
||||
('enonkoski', "Enonkoski"),
|
||||
('enontekio', "Enontekiö"),
|
||||
('espoo', "Espoo"),
|
||||
('eura', "Eura"),
|
||||
('eurajoki', "Eurajoki"),
|
||||
('evijarvi', "Evijärvi"),
|
||||
('finstrom', "Finström"),
|
||||
('forssa', "Forssa"),
|
||||
('foglo', "Föglö"),
|
||||
('geta', "Geta"),
|
||||
('haapajarvi', "Haapajärvi"),
|
||||
('haapavesi', "Haapavesi"),
|
||||
('hailuoto', "Hailuoto"),
|
||||
('halsua', "Halsua"),
|
||||
('hamina', "Hamina"),
|
||||
('hammarland', "Hammarland"),
|
||||
('hankasalmi', "Hankasalmi"),
|
||||
('hanko', "Hanko"),
|
||||
('harjavalta', "Harjavalta"),
|
||||
('hartola', "Hartola"),
|
||||
('hattula', "Hattula"),
|
||||
('haukipudas', "Haukipudas"),
|
||||
('hausjarvi', "Hausjärvi"),
|
||||
('heinola', "Heinola"),
|
||||
('heinavesi', "Heinävesi"),
|
||||
('helsinki', "Helsinki"),
|
||||
('hirvensalmi', "Hirvensalmi"),
|
||||
('hollola', "Hollola"),
|
||||
('honkajoki', "Honkajoki"),
|
||||
('huittinen', "Huittinen"),
|
||||
('humppila', "Humppila"),
|
||||
('hyrynsalmi', "Hyrynsalmi"),
|
||||
('hyvinkaa', "Hyvinkää"),
|
||||
('hameenkoski', "Hämeenkoski"),
|
||||
('hameenkyro', "Hämeenkyrö"),
|
||||
('hameenlinna', "Hämeenlinna"),
|
||||
('ii', "Ii"),
|
||||
('iisalmi', "Iisalmi"),
|
||||
('iitti', "Iitti"),
|
||||
('ikaalinen', "Ikaalinen"),
|
||||
('ilmajoki', "Ilmajoki"),
|
||||
('ilomantsi', "Ilomantsi"),
|
||||
('imatra', "Imatra"),
|
||||
('inari', "Inari"),
|
||||
('inkoo', "Inkoo"),
|
||||
('isojoki', "Isojoki"),
|
||||
('isokyro', "Isokyrö"),
|
||||
('jalasjarvi', "Jalasjärvi"),
|
||||
('janakkala', "Janakkala"),
|
||||
('joensuu', "Joensuu"),
|
||||
('jokioinen', "Jokioinen"),
|
||||
('jomala', "Jomala"),
|
||||
('joroinen', "Joroinen"),
|
||||
('joutsa', "Joutsa"),
|
||||
('juankoski', "Juankoski"),
|
||||
('juuka', "Juuka"),
|
||||
('juupajoki', "Juupajoki"),
|
||||
('juva', "Juva"),
|
||||
('jyvaskyla', "Jyväskylä"),
|
||||
('jamijarvi', "Jämijärvi"),
|
||||
('jamsa', "Jämsä"),
|
||||
('jarvenpaa', "Järvenpää"),
|
||||
('kaarina', "Kaarina"),
|
||||
('kaavi', "Kaavi"),
|
||||
('kajaani', "Kajaani"),
|
||||
('kalajoki', "Kalajoki"),
|
||||
('kangasala', "Kangasala"),
|
||||
('kangasniemi', "Kangasniemi"),
|
||||
('kankaanpaa', "Kankaanpää"),
|
||||
('kannonkoski', "Kannonkoski"),
|
||||
('kannus', "Kannus"),
|
||||
('karijoki', "Karijoki"),
|
||||
('karjalohja', "Karjalohja"),
|
||||
('karkkila', "Karkkila"),
|
||||
('karstula', "Karstula"),
|
||||
('karttula', "Karttula"),
|
||||
('karvia', "Karvia"),
|
||||
('kaskinen', "Kaskinen"),
|
||||
('kauhajoki', "Kauhajoki"),
|
||||
('kauhava', "Kauhava"),
|
||||
('kauniainen', "Kauniainen"),
|
||||
('kaustinen', "Kaustinen"),
|
||||
('keitele', "Keitele"),
|
||||
('kemi', "Kemi"),
|
||||
('kemijarvi', "Kemijärvi"),
|
||||
('keminmaa', "Keminmaa"),
|
||||
('kemionsaari', "Kemiönsaari"),
|
||||
('kempele', "Kempele"),
|
||||
('kerava', "Kerava"),
|
||||
('kerimaki', "Kerimäki"),
|
||||
('kesalahti', "Kesälahti"),
|
||||
('keuruu', "Keuruu"),
|
||||
('kihnio', "Kihniö"),
|
||||
('kiikoinen', "Kiikoinen"),
|
||||
('kiiminki', "Kiiminki"),
|
||||
('kinnula', "Kinnula"),
|
||||
('kirkkonummi', "Kirkkonummi"),
|
||||
('kitee', "Kitee"),
|
||||
('kittila', "Kittilä"),
|
||||
('kiuruvesi', "Kiuruvesi"),
|
||||
('kivijarvi', "Kivijärvi"),
|
||||
('kokemaki', "Kokemäki"),
|
||||
('kokkola', "Kokkola"),
|
||||
('kolari', "Kolari"),
|
||||
('konnevesi', "Konnevesi"),
|
||||
('kontiolahti', "Kontiolahti"),
|
||||
('korsnas', "Korsnäs"),
|
||||
('koskitl', "Koski Tl"),
|
||||
('kotka', "Kotka"),
|
||||
('kouvola', "Kouvola"),
|
||||
('kristiinankaupunki', "Kristiinankaupunki"),
|
||||
('kruunupyy', "Kruunupyy"),
|
||||
('kuhmalahti', "Kuhmalahti"),
|
||||
('kuhmo', "Kuhmo"),
|
||||
('kuhmoinen', "Kuhmoinen"),
|
||||
('kumlinge', "Kumlinge"),
|
||||
('kuopio', "Kuopio"),
|
||||
('kuortane', "Kuortane"),
|
||||
('kurikka', "Kurikka"),
|
||||
('kustavi', "Kustavi"),
|
||||
('kuusamo', "Kuusamo"),
|
||||
('kylmakoski', "Kylmäkoski"),
|
||||
('kyyjarvi', "Kyyjärvi"),
|
||||
('karkola', "Kärkölä"),
|
||||
('karsamaki', "Kärsämäki"),
|
||||
('kokar', "Kökar"),
|
||||
('koylio', "Köyliö"),
|
||||
('lahti', "Lahti"),
|
||||
('laihia', "Laihia"),
|
||||
('laitila', "Laitila"),
|
||||
('lapinjarvi', "Lapinjärvi"),
|
||||
('lapinlahti', "Lapinlahti"),
|
||||
('lappajarvi', "Lappajärvi"),
|
||||
('lappeenranta', "Lappeenranta"),
|
||||
('lapua', "Lapua"),
|
||||
('laukaa', "Laukaa"),
|
||||
('lavia', "Lavia"),
|
||||
('lemi', "Lemi"),
|
||||
('lemland', "Lemland"),
|
||||
('lempaala', "Lempäälä"),
|
||||
('leppavirta', "Leppävirta"),
|
||||
('lestijarvi', "Lestijärvi"),
|
||||
('lieksa', "Lieksa"),
|
||||
('lieto', "Lieto"),
|
||||
('liminka', "Liminka"),
|
||||
('liperi', "Liperi"),
|
||||
('lohja', "Lohja"),
|
||||
('loimaa', "Loimaa"),
|
||||
('loppi', "Loppi"),
|
||||
('loviisa', "Loviisa"),
|
||||
('luhanka', "Luhanka"),
|
||||
('lumijoki', "Lumijoki"),
|
||||
('lumparland', "Lumparland"),
|
||||
('luoto', "Luoto"),
|
||||
('luumaki', "Luumäki"),
|
||||
('luvia', "Luvia"),
|
||||
('lansi-turunmaa', "Länsi-Turunmaa"),
|
||||
('maalahti', "Maalahti"),
|
||||
('maaninka', "Maaninka"),
|
||||
('maarianhamina', "Maarianhamina"),
|
||||
('marttila', "Marttila"),
|
||||
('masku', "Masku"),
|
||||
('merijarvi', "Merijärvi"),
|
||||
('merikarvia', "Merikarvia"),
|
||||
('miehikkala', "Miehikkälä"),
|
||||
('mikkeli', "Mikkeli"),
|
||||
('muhos', "Muhos"),
|
||||
('multia', "Multia"),
|
||||
('muonio', "Muonio"),
|
||||
('mustasaari', "Mustasaari"),
|
||||
('muurame', "Muurame"),
|
||||
('mynamaki', "Mynämäki"),
|
||||
('myrskyla', "Myrskylä"),
|
||||
('mantsala', "Mäntsälä"),
|
||||
('mantta-vilppula', "Mänttä-Vilppula"),
|
||||
('mantyharju', "Mäntyharju"),
|
||||
('naantali', "Naantali"),
|
||||
('nakkila', "Nakkila"),
|
||||
('nastola', "Nastola"),
|
||||
('nilsia', "Nilsiä"),
|
||||
('nivala', "Nivala"),
|
||||
('nokia', "Nokia"),
|
||||
('nousiainen', "Nousiainen"),
|
||||
('nummi-pusula', "Nummi-Pusula"),
|
||||
('nurmes', "Nurmes"),
|
||||
('nurmijarvi', "Nurmijärvi"),
|
||||
('narpio', "Närpiö"),
|
||||
('oravainen', "Oravainen"),
|
||||
('orimattila', "Orimattila"),
|
||||
('oripaa', "Oripää"),
|
||||
('orivesi', "Orivesi"),
|
||||
('oulainen', "Oulainen"),
|
||||
('oulu', "Oulu"),
|
||||
('oulunsalo', "Oulunsalo"),
|
||||
('outokumpu', "Outokumpu"),
|
||||
('padasjoki', "Padasjoki"),
|
||||
('paimio', "Paimio"),
|
||||
('paltamo', "Paltamo"),
|
||||
('parikkala', "Parikkala"),
|
||||
('parkano', "Parkano"),
|
||||
('pedersore', "Pedersöre"),
|
||||
('pelkosenniemi', "Pelkosenniemi"),
|
||||
('pello', "Pello"),
|
||||
('perho', "Perho"),
|
||||
('pertunmaa', "Pertunmaa"),
|
||||
('petajavesi', "Petäjävesi"),
|
||||
('pieksamaki', "Pieksämäki"),
|
||||
('pielavesi', "Pielavesi"),
|
||||
('pietarsaari', "Pietarsaari"),
|
||||
('pihtipudas', "Pihtipudas"),
|
||||
('pirkkala', "Pirkkala"),
|
||||
('polvijarvi', "Polvijärvi"),
|
||||
('pomarkku', "Pomarkku"),
|
||||
('pori', "Pori"),
|
||||
('pornainen', "Pornainen"),
|
||||
('porvoo', "Porvoo"),
|
||||
('posio', "Posio"),
|
||||
('pudasjarvi', "Pudasjärvi"),
|
||||
('pukkila', "Pukkila"),
|
||||
('punkaharju', "Punkaharju"),
|
||||
('punkalaidun', "Punkalaidun"),
|
||||
('puolanka', "Puolanka"),
|
||||
('puumala', "Puumala"),
|
||||
('pyhtaa', "Pyhtää"),
|
||||
('pyhajoki', "Pyhäjoki"),
|
||||
('pyhajarvi', "Pyhäjärvi"),
|
||||
('pyhanta', "Pyhäntä"),
|
||||
('pyharanta', "Pyhäranta"),
|
||||
('palkane', "Pälkäne"),
|
||||
('poytya', "Pöytyä"),
|
||||
('raahe', "Raahe"),
|
||||
('raasepori', "Raasepori"),
|
||||
('raisio', "Raisio"),
|
||||
('rantasalmi', "Rantasalmi"),
|
||||
('ranua', "Ranua"),
|
||||
('rauma', "Rauma"),
|
||||
('rautalampi', "Rautalampi"),
|
||||
('rautavaara', "Rautavaara"),
|
||||
('rautjarvi', "Rautjärvi"),
|
||||
('reisjarvi', "Reisjärvi"),
|
||||
('riihimaki', "Riihimäki"),
|
||||
('ristiina', "Ristiina"),
|
||||
('ristijarvi', "Ristijärvi"),
|
||||
('rovaniemi', "Rovaniemi"),
|
||||
('ruokolahti', "Ruokolahti"),
|
||||
('ruovesi', "Ruovesi"),
|
||||
('rusko', "Rusko"),
|
||||
('raakkyla', "Rääkkylä"),
|
||||
('saarijarvi', "Saarijärvi"),
|
||||
('salla', "Salla"),
|
||||
('salo', "Salo"),
|
||||
('saltvik', "Saltvik"),
|
||||
('sastamala', "Sastamala"),
|
||||
('sauvo', "Sauvo"),
|
||||
('savitaipale', "Savitaipale"),
|
||||
('savonlinna', "Savonlinna"),
|
||||
('savukoski', "Savukoski"),
|
||||
('seinajoki', "Seinäjoki"),
|
||||
('sievi', "Sievi"),
|
||||
('siikainen', "Siikainen"),
|
||||
('siikajoki', "Siikajoki"),
|
||||
('siikalatva', "Siikalatva"),
|
||||
('siilinjarvi', "Siilinjärvi"),
|
||||
('simo', "Simo"),
|
||||
('sipoo', "Sipoo"),
|
||||
('siuntio', "Siuntio"),
|
||||
('sodankyla', "Sodankylä"),
|
||||
('soini', "Soini"),
|
||||
('somero', "Somero"),
|
||||
('sonkajarvi', "Sonkajärvi"),
|
||||
('sotkamo', "Sotkamo"),
|
||||
('sottunga', "Sottunga"),
|
||||
('sulkava', "Sulkava"),
|
||||
('sund', "Sund"),
|
||||
('suomenniemi', "Suomenniemi"),
|
||||
('suomussalmi', "Suomussalmi"),
|
||||
('suonenjoki', "Suonenjoki"),
|
||||
('sysma', "Sysmä"),
|
||||
('sakyla', "Säkylä"),
|
||||
('taipalsaari', "Taipalsaari"),
|
||||
('taivalkoski', "Taivalkoski"),
|
||||
('taivassalo', "Taivassalo"),
|
||||
('tammela', "Tammela"),
|
||||
('tampere', "Tampere"),
|
||||
('tarvasjoki', "Tarvasjoki"),
|
||||
('tervo', "Tervo"),
|
||||
('tervola', "Tervola"),
|
||||
('teuva', "Teuva"),
|
||||
('tohmajarvi', "Tohmajärvi"),
|
||||
('toholampi', "Toholampi"),
|
||||
('toivakka', "Toivakka"),
|
||||
('tornio', "Tornio"),
|
||||
('turku', "Turku"),
|
||||
('tuusniemi', "Tuusniemi"),
|
||||
('tuusula', "Tuusula"),
|
||||
('tyrnava', "Tyrnävä"),
|
||||
('toysa', "Töysä"),
|
||||
('ulvila', "Ulvila"),
|
||||
('urjala', "Urjala"),
|
||||
('utajarvi', "Utajärvi"),
|
||||
('utsjoki', "Utsjoki"),
|
||||
('uurainen', "Uurainen"),
|
||||
('uusikaarlepyy', "Uusikaarlepyy"),
|
||||
('uusikaupunki', "Uusikaupunki"),
|
||||
('vaala', "Vaala"),
|
||||
('vaasa', "Vaasa"),
|
||||
('valkeakoski', "Valkeakoski"),
|
||||
('valtimo', "Valtimo"),
|
||||
('vantaa', "Vantaa"),
|
||||
('varkaus', "Varkaus"),
|
||||
('varpaisjarvi', "Varpaisjärvi"),
|
||||
('vehmaa', "Vehmaa"),
|
||||
('vesanto', "Vesanto"),
|
||||
('vesilahti', "Vesilahti"),
|
||||
('veteli', "Veteli"),
|
||||
('vierema', "Vieremä"),
|
||||
('vihanti', "Vihanti"),
|
||||
('vihti', "Vihti"),
|
||||
('viitasaari', "Viitasaari"),
|
||||
('vimpeli', "Vimpeli"),
|
||||
('virolahti', "Virolahti"),
|
||||
('virrat', "Virrat"),
|
||||
('vardo', "Vårdö"),
|
||||
('vahakyro', "Vähäkyrö"),
|
||||
('voyri-maksamaa', "Vöyri-Maksamaa"),
|
||||
('yli-ii', "Yli-Ii"),
|
||||
('ylitornio', "Ylitornio"),
|
||||
('ylivieska', "Ylivieska"),
|
||||
('ylojarvi', "Ylöjärvi"),
|
||||
('ypaja', "Ypäjä"),
|
||||
('ahtari', "Ähtäri"),
|
||||
('aanekoski', "Äänekoski")
|
||||
)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
FI-specific Form helpers
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
|
@ -36,7 +36,7 @@ class FISocialSecurityNumber(Field):
|
|||
def clean(self, value):
|
||||
super(FISocialSecurityNumber, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
checkmarks = "0123456789ABCDEFHJKLMNPRSTUVWXY"
|
||||
result = re.match(r"""^
|
||||
|
@ -51,5 +51,5 @@ class FISocialSecurityNumber(Field):
|
|||
gd = result.groupdict()
|
||||
checksum = int(gd['date'] + gd['serial'])
|
||||
if checkmarks[checksum % len(checkmarks)] == gd['checksum'].upper():
|
||||
return u'%s' % value.upper()
|
||||
return '%s' % value.upper()
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
FR-specific Form helpers
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
|
@ -38,11 +38,11 @@ class FRPhoneNumberField(Field):
|
|||
def clean(self, value):
|
||||
super(FRPhoneNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
value = re.sub('(\.|\s)', '', smart_unicode(value))
|
||||
m = phone_digits_re.search(value)
|
||||
if m:
|
||||
return u'%s %s %s %s %s' % (value[0:2], value[2:4], value[4:6], value[6:8], value[8:10])
|
||||
return '%s %s %s %s %s' % (value[0:2], value[2:4], value[4:6], value[6:8], value[8:10])
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
||||
class FRDepartmentSelect(Select):
|
||||
|
|
|
@ -1,117 +1,118 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# See the "Code officiel géographique" on the INSEE website <www.insee.fr>.
|
||||
from __future__ import unicode_literals
|
||||
|
||||
DEPARTMENT_CHOICES = (
|
||||
# Metropolitan departments
|
||||
('01', u'01 - Ain'),
|
||||
('02', u'02 - Aisne'),
|
||||
('03', u'03 - Allier'),
|
||||
('04', u'04 - Alpes-de-Haute-Provence'),
|
||||
('05', u'05 - Hautes-Alpes'),
|
||||
('06', u'06 - Alpes-Maritimes'),
|
||||
('07', u'07 - Ardèche'),
|
||||
('08', u'08 - Ardennes'),
|
||||
('09', u'09 - Ariège'),
|
||||
('10', u'10 - Aube'),
|
||||
('11', u'11 - Aude'),
|
||||
('12', u'12 - Aveyron'),
|
||||
('13', u'13 - Bouches-du-Rhône'),
|
||||
('14', u'14 - Calvados'),
|
||||
('15', u'15 - Cantal'),
|
||||
('16', u'16 - Charente'),
|
||||
('17', u'17 - Charente-Maritime'),
|
||||
('18', u'18 - Cher'),
|
||||
('19', u'19 - Corrèze'),
|
||||
('2A', u'2A - Corse-du-Sud'),
|
||||
('2B', u'2B - Haute-Corse'),
|
||||
('21', u'21 - Côte-d\'Or'),
|
||||
('22', u'22 - Côtes-d\'Armor'),
|
||||
('23', u'23 - Creuse'),
|
||||
('24', u'24 - Dordogne'),
|
||||
('25', u'25 - Doubs'),
|
||||
('26', u'26 - Drôme'),
|
||||
('27', u'27 - Eure'),
|
||||
('28', u'28 - Eure-et-Loir'),
|
||||
('29', u'29 - Finistère'),
|
||||
('30', u'30 - Gard'),
|
||||
('31', u'31 - Haute-Garonne'),
|
||||
('32', u'32 - Gers'),
|
||||
('33', u'33 - Gironde'),
|
||||
('34', u'34 - Hérault'),
|
||||
('35', u'35 - Ille-et-Vilaine'),
|
||||
('36', u'36 - Indre'),
|
||||
('37', u'37 - Indre-et-Loire'),
|
||||
('38', u'38 - Isère'),
|
||||
('39', u'39 - Jura'),
|
||||
('40', u'40 - Landes'),
|
||||
('41', u'41 - Loir-et-Cher'),
|
||||
('42', u'42 - Loire'),
|
||||
('43', u'43 - Haute-Loire'),
|
||||
('44', u'44 - Loire-Atlantique'),
|
||||
('45', u'45 - Loiret'),
|
||||
('46', u'46 - Lot'),
|
||||
('47', u'47 - Lot-et-Garonne'),
|
||||
('48', u'48 - Lozère'),
|
||||
('49', u'49 - Maine-et-Loire'),
|
||||
('50', u'50 - Manche'),
|
||||
('51', u'51 - Marne'),
|
||||
('52', u'52 - Haute-Marne'),
|
||||
('53', u'53 - Mayenne'),
|
||||
('54', u'54 - Meurthe-et-Moselle'),
|
||||
('55', u'55 - Meuse'),
|
||||
('56', u'56 - Morbihan'),
|
||||
('57', u'57 - Moselle'),
|
||||
('58', u'58 - Nièvre'),
|
||||
('59', u'59 - Nord'),
|
||||
('60', u'60 - Oise'),
|
||||
('61', u'61 - Orne'),
|
||||
('62', u'62 - Pas-de-Calais'),
|
||||
('63', u'63 - Puy-de-Dôme'),
|
||||
('64', u'64 - Pyrénées-Atlantiques'),
|
||||
('65', u'65 - Hautes-Pyrénées'),
|
||||
('66', u'66 - Pyrénées-Orientales'),
|
||||
('67', u'67 - Bas-Rhin'),
|
||||
('68', u'68 - Haut-Rhin'),
|
||||
('69', u'69 - Rhône'),
|
||||
('70', u'70 - Haute-Saône'),
|
||||
('71', u'71 - Saône-et-Loire'),
|
||||
('72', u'72 - Sarthe'),
|
||||
('73', u'73 - Savoie'),
|
||||
('74', u'74 - Haute-Savoie'),
|
||||
('75', u'75 - Paris'),
|
||||
('76', u'76 - Seine-Maritime'),
|
||||
('77', u'77 - Seine-et-Marne'),
|
||||
('78', u'78 - Yvelines'),
|
||||
('79', u'79 - Deux-Sèvres'),
|
||||
('80', u'80 - Somme'),
|
||||
('81', u'81 - Tarn'),
|
||||
('82', u'82 - Tarn-et-Garonne'),
|
||||
('83', u'83 - Var'),
|
||||
('84', u'84 - Vaucluse'),
|
||||
('85', u'85 - Vendée'),
|
||||
('86', u'86 - Vienne'),
|
||||
('87', u'87 - Haute-Vienne'),
|
||||
('88', u'88 - Vosges'),
|
||||
('89', u'89 - Yonne'),
|
||||
('90', u'90 - Territoire de Belfort'),
|
||||
('91', u'91 - Essonne'),
|
||||
('92', u'92 - Hauts-de-Seine'),
|
||||
('93', u'93 - Seine-Saint-Denis'),
|
||||
('94', u'94 - Val-de-Marne'),
|
||||
('95', u'95 - Val-d\'Oise'),
|
||||
('01', '01 - Ain'),
|
||||
('02', '02 - Aisne'),
|
||||
('03', '03 - Allier'),
|
||||
('04', '04 - Alpes-de-Haute-Provence'),
|
||||
('05', '05 - Hautes-Alpes'),
|
||||
('06', '06 - Alpes-Maritimes'),
|
||||
('07', '07 - Ardèche'),
|
||||
('08', '08 - Ardennes'),
|
||||
('09', '09 - Ariège'),
|
||||
('10', '10 - Aube'),
|
||||
('11', '11 - Aude'),
|
||||
('12', '12 - Aveyron'),
|
||||
('13', '13 - Bouches-du-Rhône'),
|
||||
('14', '14 - Calvados'),
|
||||
('15', '15 - Cantal'),
|
||||
('16', '16 - Charente'),
|
||||
('17', '17 - Charente-Maritime'),
|
||||
('18', '18 - Cher'),
|
||||
('19', '19 - Corrèze'),
|
||||
('2A', '2A - Corse-du-Sud'),
|
||||
('2B', '2B - Haute-Corse'),
|
||||
('21', '21 - Côte-d\'Or'),
|
||||
('22', '22 - Côtes-d\'Armor'),
|
||||
('23', '23 - Creuse'),
|
||||
('24', '24 - Dordogne'),
|
||||
('25', '25 - Doubs'),
|
||||
('26', '26 - Drôme'),
|
||||
('27', '27 - Eure'),
|
||||
('28', '28 - Eure-et-Loir'),
|
||||
('29', '29 - Finistère'),
|
||||
('30', '30 - Gard'),
|
||||
('31', '31 - Haute-Garonne'),
|
||||
('32', '32 - Gers'),
|
||||
('33', '33 - Gironde'),
|
||||
('34', '34 - Hérault'),
|
||||
('35', '35 - Ille-et-Vilaine'),
|
||||
('36', '36 - Indre'),
|
||||
('37', '37 - Indre-et-Loire'),
|
||||
('38', '38 - Isère'),
|
||||
('39', '39 - Jura'),
|
||||
('40', '40 - Landes'),
|
||||
('41', '41 - Loir-et-Cher'),
|
||||
('42', '42 - Loire'),
|
||||
('43', '43 - Haute-Loire'),
|
||||
('44', '44 - Loire-Atlantique'),
|
||||
('45', '45 - Loiret'),
|
||||
('46', '46 - Lot'),
|
||||
('47', '47 - Lot-et-Garonne'),
|
||||
('48', '48 - Lozère'),
|
||||
('49', '49 - Maine-et-Loire'),
|
||||
('50', '50 - Manche'),
|
||||
('51', '51 - Marne'),
|
||||
('52', '52 - Haute-Marne'),
|
||||
('53', '53 - Mayenne'),
|
||||
('54', '54 - Meurthe-et-Moselle'),
|
||||
('55', '55 - Meuse'),
|
||||
('56', '56 - Morbihan'),
|
||||
('57', '57 - Moselle'),
|
||||
('58', '58 - Nièvre'),
|
||||
('59', '59 - Nord'),
|
||||
('60', '60 - Oise'),
|
||||
('61', '61 - Orne'),
|
||||
('62', '62 - Pas-de-Calais'),
|
||||
('63', '63 - Puy-de-Dôme'),
|
||||
('64', '64 - Pyrénées-Atlantiques'),
|
||||
('65', '65 - Hautes-Pyrénées'),
|
||||
('66', '66 - Pyrénées-Orientales'),
|
||||
('67', '67 - Bas-Rhin'),
|
||||
('68', '68 - Haut-Rhin'),
|
||||
('69', '69 - Rhône'),
|
||||
('70', '70 - Haute-Saône'),
|
||||
('71', '71 - Saône-et-Loire'),
|
||||
('72', '72 - Sarthe'),
|
||||
('73', '73 - Savoie'),
|
||||
('74', '74 - Haute-Savoie'),
|
||||
('75', '75 - Paris'),
|
||||
('76', '76 - Seine-Maritime'),
|
||||
('77', '77 - Seine-et-Marne'),
|
||||
('78', '78 - Yvelines'),
|
||||
('79', '79 - Deux-Sèvres'),
|
||||
('80', '80 - Somme'),
|
||||
('81', '81 - Tarn'),
|
||||
('82', '82 - Tarn-et-Garonne'),
|
||||
('83', '83 - Var'),
|
||||
('84', '84 - Vaucluse'),
|
||||
('85', '85 - Vendée'),
|
||||
('86', '86 - Vienne'),
|
||||
('87', '87 - Haute-Vienne'),
|
||||
('88', '88 - Vosges'),
|
||||
('89', '89 - Yonne'),
|
||||
('90', '90 - Territoire de Belfort'),
|
||||
('91', '91 - Essonne'),
|
||||
('92', '92 - Hauts-de-Seine'),
|
||||
('93', '93 - Seine-Saint-Denis'),
|
||||
('94', '94 - Val-de-Marne'),
|
||||
('95', '95 - Val-d\'Oise'),
|
||||
# Overseas departments, communities, and other territories
|
||||
('971', u'971 - Guadeloupe'),
|
||||
('972', u'972 - Martinique'),
|
||||
('973', u'973 - Guyane'),
|
||||
('974', u'974 - La Réunion'),
|
||||
('975', u'975 - Saint-Pierre-et-Miquelon'),
|
||||
('976', u'976 - Mayotte'),
|
||||
('977', u'977 - Saint-Barthélemy'),
|
||||
('978', u'978 - Saint-Martin'),
|
||||
('984', u'984 - Terres australes et antarctiques françaises'),
|
||||
('986', u'986 - Wallis et Futuna'),
|
||||
('987', u'987 - Polynésie française'),
|
||||
('988', u'988 - Nouvelle-Calédonie'),
|
||||
('989', u'989 - Île de Clipperton'),
|
||||
('971', '971 - Guadeloupe'),
|
||||
('972', '972 - Martinique'),
|
||||
('973', '973 - Guyane'),
|
||||
('974', '974 - La Réunion'),
|
||||
('975', '975 - Saint-Pierre-et-Miquelon'),
|
||||
('976', '976 - Mayotte'),
|
||||
('977', '977 - Saint-Barthélemy'),
|
||||
('978', '978 - Saint-Martin'),
|
||||
('984', '984 - Terres australes et antarctiques françaises'),
|
||||
('986', '986 - Wallis et Futuna'),
|
||||
('987', '987 - Polynésie française'),
|
||||
('988', '988 - Nouvelle-Calédonie'),
|
||||
('989', '989 - Île de Clipperton'),
|
||||
)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
GB-specific Form helpers
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
|
@ -22,7 +22,7 @@ class GBPostcodeField(CharField):
|
|||
The value is uppercased and a space added in the correct place, if required.
|
||||
"""
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Enter a valid postcode.'),
|
||||
'invalid': _('Enter a valid postcode.'),
|
||||
}
|
||||
outcode_pattern = '[A-PR-UWYZ]([0-9]{1,2}|([A-HIK-Y][0-9](|[0-9]|[ABEHMNPRVWXY]))|[0-9][A-HJKSTUW])'
|
||||
incode_pattern = '[0-9][ABD-HJLNP-UW-Z]{2}'
|
||||
|
@ -31,7 +31,7 @@ class GBPostcodeField(CharField):
|
|||
|
||||
def clean(self, value):
|
||||
value = super(GBPostcodeField, self).clean(value)
|
||||
if value == u'':
|
||||
if value == '':
|
||||
return value
|
||||
postcode = value.upper().strip()
|
||||
# Put a single space before the incode (second part).
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
Hong Kong specific Form helpers
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
|
@ -51,14 +51,14 @@ class HKPhoneNumberField(CharField):
|
|||
super(HKPhoneNumberField, self).clean(value)
|
||||
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
value = re.sub('(\(|\)|\s+|\+)', '', smart_unicode(value))
|
||||
m = hk_phone_digits_re.search(value)
|
||||
if not m:
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
||||
value = u'%s-%s' % (m.group(1), m.group(2))
|
||||
value = '%s-%s' % (m.group(1), m.group(2))
|
||||
for special in hk_special_numbers:
|
||||
if value.startswith(special):
|
||||
raise ValidationError(self.error_messages['disguise'])
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"""
|
||||
HR-specific Form helpers
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
|
@ -19,8 +19,8 @@ from django.utils.translation import ugettext_lazy as _
|
|||
jmbg_re = re.compile(r'^(?P<dd>\d{2})(?P<mm>\d{2})(?P<yyy>\d{3})' + \
|
||||
r'(?P<rr>\d{2})(?P<bbb>\d{3})(?P<k>\d{1})$')
|
||||
oib_re = re.compile(r'^\d{11}$')
|
||||
plate_re = re.compile(ur'^(?P<prefix>[A-ZČŠŽ]{2})' + \
|
||||
ur'(?P<number>\d{3,4})(?P<suffix>[ABCDEFGHIJKLMNOPRSTUVZ]{1,2})$')
|
||||
plate_re = re.compile(r'^(?P<prefix>[A-ZČŠŽ]{2})' + \
|
||||
r'(?P<number>\d{3,4})(?P<suffix>[ABCDEFGHIJKLMNOPRSTUVZ]{1,2})$')
|
||||
postal_code_re = re.compile(r'^\d{5}$')
|
||||
phone_re = re.compile(r'^(\+385|00385|0)(?P<prefix>\d{2})(?P<number>\d{6,7})$')
|
||||
jmbag_re = re.compile(r'^601983(?P<copy>\d{1})1(?P<jmbag>\d{10})(?P<k>\d{1})$')
|
||||
|
@ -79,7 +79,7 @@ class HRJMBGField(Field):
|
|||
def clean(self, value):
|
||||
super(HRJMBGField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
value = value.strip()
|
||||
|
||||
|
@ -110,7 +110,7 @@ class HRJMBGField(Field):
|
|||
if not str(m) == k:
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
||||
return u'%s' % (value, )
|
||||
return '%s' % (value, )
|
||||
|
||||
|
||||
class HROIBField(RegexField):
|
||||
|
@ -130,7 +130,7 @@ class HROIBField(RegexField):
|
|||
def clean(self, value):
|
||||
super(HROIBField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
return '%s' % (value, )
|
||||
|
||||
|
@ -157,7 +157,7 @@ class HRLicensePlateField(Field):
|
|||
def clean(self, value):
|
||||
super(HRLicensePlateField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
value = re.sub(r'[\s\-]+', '', smart_unicode(value.strip())).upper()
|
||||
|
||||
|
@ -175,7 +175,7 @@ class HRLicensePlateField(Field):
|
|||
if int(number) == 0:
|
||||
raise ValidationError(self.error_messages['number'])
|
||||
|
||||
return u'%s %s-%s' % (prefix,number,matches.group('suffix'), )
|
||||
return '%s %s-%s' % (prefix,number,matches.group('suffix'), )
|
||||
|
||||
|
||||
class HRPostalCodeField(Field):
|
||||
|
@ -193,7 +193,7 @@ class HRPostalCodeField(Field):
|
|||
def clean(self, value):
|
||||
super(HRPostalCodeField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
value = value.strip()
|
||||
if not postal_code_re.search(value):
|
||||
|
@ -223,7 +223,7 @@ class HRPhoneNumberField(Field):
|
|||
def clean(self, value):
|
||||
super(HRPhoneNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
value = re.sub(r'[\-\s\(\)]', '', smart_unicode(value))
|
||||
|
||||
|
@ -262,7 +262,7 @@ class HRJMBAGField(Field):
|
|||
def clean(self, value):
|
||||
super(HRJMBAGField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
value = re.sub(r'[\-\s]', '', value.strip())
|
||||
|
||||
|
|
|
@ -6,30 +6,32 @@ Sources:
|
|||
Croatia doesn't have official abbreviations for counties.
|
||||
The ones provided are in common use.
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
HR_COUNTY_CHOICES = (
|
||||
('GZG', _('Grad Zagreb')),
|
||||
(u'BBŽ', _(u'Bjelovarsko-bilogorska županija')),
|
||||
(u'BPŽ', _(u'Brodsko-posavska županija')),
|
||||
(u'DNŽ', _(u'Dubrovačko-neretvanska županija')),
|
||||
(u'IŽ', _(u'Istarska županija')),
|
||||
(u'KŽ', _(u'Karlovačka županija')),
|
||||
(u'KKŽ', _(u'Koprivničko-križevačka županija')),
|
||||
(u'KZŽ', _(u'Krapinsko-zagorska županija')),
|
||||
(u'LSŽ', _(u'Ličko-senjska županija')),
|
||||
(u'MŽ', _(u'Međimurska županija')),
|
||||
(u'OBŽ', _(u'Osječko-baranjska županija')),
|
||||
(u'PSŽ', _(u'Požeško-slavonska županija')),
|
||||
(u'PGŽ', _(u'Primorsko-goranska županija')),
|
||||
(u'SMŽ', _(u'Sisačko-moslavačka županija')),
|
||||
(u'SDŽ', _(u'Splitsko-dalmatinska županija')),
|
||||
(u'ŠKŽ', _(u'Šibensko-kninska županija')),
|
||||
(u'VŽ', _(u'Varaždinska županija')),
|
||||
(u'VPŽ', _(u'Virovitičko-podravska županija')),
|
||||
(u'VSŽ', _(u'Vukovarsko-srijemska županija')),
|
||||
(u'ZDŽ', _(u'Zadarska županija')),
|
||||
(u'ZGŽ', _(u'Zagrebačka županija')),
|
||||
('BBŽ', _('Bjelovarsko-bilogorska županija')),
|
||||
('BPŽ', _('Brodsko-posavska županija')),
|
||||
('DNŽ', _('Dubrovačko-neretvanska županija')),
|
||||
('IŽ', _('Istarska županija')),
|
||||
('KŽ', _('Karlovačka županija')),
|
||||
('KKŽ', _('Koprivničko-križevačka županija')),
|
||||
('KZŽ', _('Krapinsko-zagorska županija')),
|
||||
('LSŽ', _('Ličko-senjska županija')),
|
||||
('MŽ', _('Međimurska županija')),
|
||||
('OBŽ', _('Osječko-baranjska županija')),
|
||||
('PSŽ', _('Požeško-slavonska županija')),
|
||||
('PGŽ', _('Primorsko-goranska županija')),
|
||||
('SMŽ', _('Sisačko-moslavačka županija')),
|
||||
('SDŽ', _('Splitsko-dalmatinska županija')),
|
||||
('ŠKŽ', _('Šibensko-kninska županija')),
|
||||
('VŽ', _('Varaždinska županija')),
|
||||
('VPŽ', _('Virovitičko-podravska županija')),
|
||||
('VSŽ', _('Vukovarsko-srijemska županija')),
|
||||
('ZDŽ', _('Zadarska županija')),
|
||||
('ZGŽ', _('Zagrebačka županija')),
|
||||
)
|
||||
|
||||
"""
|
||||
|
@ -42,7 +44,7 @@ Only common license plate prefixes are provided. Special cases and obsolete pref
|
|||
HR_LICENSE_PLATE_PREFIX_CHOICES = (
|
||||
('BJ', 'BJ'),
|
||||
('BM', 'BM'),
|
||||
(u'ČK', u'ČK'),
|
||||
('ČK', 'ČK'),
|
||||
('DA', 'DA'),
|
||||
('DE', 'DE'),
|
||||
('DJ', 'DJ'),
|
||||
|
@ -53,27 +55,27 @@ HR_LICENSE_PLATE_PREFIX_CHOICES = (
|
|||
('KC', 'KC'),
|
||||
('KR', 'KR'),
|
||||
('KT', 'KT'),
|
||||
(u'KŽ', u'KŽ'),
|
||||
('KŽ', 'KŽ'),
|
||||
('MA', 'MA'),
|
||||
('NA', 'NA'),
|
||||
('NG', 'NG'),
|
||||
('OG', 'OG'),
|
||||
('OS', 'OS'),
|
||||
('PU', 'PU'),
|
||||
(u'PŽ', u'PŽ'),
|
||||
('PŽ', 'PŽ'),
|
||||
('RI', 'RI'),
|
||||
('SB', 'SB'),
|
||||
('SK', 'SK'),
|
||||
('SL', 'SL'),
|
||||
('ST', 'ST'),
|
||||
(u'ŠI', u'ŠI'),
|
||||
('ŠI', 'ŠI'),
|
||||
('VK', 'VK'),
|
||||
('VT', 'VT'),
|
||||
('VU', 'VU'),
|
||||
(u'VŽ', u'VŽ'),
|
||||
('VŽ', 'VŽ'),
|
||||
('ZD', 'ZD'),
|
||||
('ZG', 'ZG'),
|
||||
(u'ŽU', u'ŽU'),
|
||||
('ŽU', 'ŽU'),
|
||||
)
|
||||
|
||||
"""
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
ID-specific Form helpers
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import re
|
||||
import time
|
||||
|
@ -34,7 +34,7 @@ class IDPostCodeField(Field):
|
|||
def clean(self, value):
|
||||
super(IDPostCodeField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
value = value.strip()
|
||||
if not postcode_re.search(value):
|
||||
|
@ -47,7 +47,7 @@ class IDPostCodeField(Field):
|
|||
if value[0] == '1' and value[4] != '0':
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
||||
return u'%s' % (value, )
|
||||
return '%s' % (value, )
|
||||
|
||||
|
||||
class IDProvinceSelect(Select):
|
||||
|
@ -75,7 +75,7 @@ class IDPhoneNumberField(Field):
|
|||
def clean(self, value):
|
||||
super(IDPhoneNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
phone_number = re.sub(r'[\-\s\(\)]', '', smart_unicode(value))
|
||||
|
||||
|
@ -117,7 +117,7 @@ class IDLicensePlateField(Field):
|
|||
from django.contrib.localflavor.id.id_choices import LICENSE_PLATE_PREFIX_CHOICES
|
||||
super(IDLicensePlateField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
plate_number = re.sub(r'\s+', ' ',
|
||||
smart_unicode(value.strip())).upper()
|
||||
|
@ -179,7 +179,7 @@ class IDNationalIdentityNumberField(Field):
|
|||
def clean(self, value):
|
||||
super(IDNationalIdentityNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
value = re.sub(r'[\s.]', '', smart_unicode(value))
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""
|
||||
Israeli-specific form helpers
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
import re
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
|
@ -28,7 +29,7 @@ class ILPostalCodeField(RegexField):
|
|||
"""
|
||||
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Enter a postal code in the format XXXXX'),
|
||||
'invalid': _('Enter a postal code in the format XXXXX'),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -47,14 +48,14 @@ class ILIDNumberField(Field):
|
|||
"""
|
||||
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Enter a valid ID number.'),
|
||||
'invalid': _('Enter a valid ID number.'),
|
||||
}
|
||||
|
||||
def clean(self, value):
|
||||
value = super(ILIDNumberField, self).clean(value)
|
||||
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
match = id_number_re.match(value)
|
||||
if not match:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
India-specific Form helpers.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
|
@ -38,7 +38,7 @@ phone_digits_re = re.compile(r"""
|
|||
|
||||
class INZipCodeField(RegexField):
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Enter a zip code in the format XXXXXX or XXX XXX.'),
|
||||
'invalid': _('Enter a zip code in the format XXXXXX or XXX XXX.'),
|
||||
}
|
||||
|
||||
def __init__(self, max_length=None, min_length=None, *args, **kwargs):
|
||||
|
@ -48,7 +48,7 @@ class INZipCodeField(RegexField):
|
|||
def clean(self, value):
|
||||
super(INZipCodeField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
# Convert to "NNNNNN" if "NNN NNN" given
|
||||
value = re.sub(r'^(\d{3})\s(\d{3})$', r'\1\2', value)
|
||||
return value
|
||||
|
@ -61,13 +61,13 @@ class INStateField(Field):
|
|||
registration abbreviation for the given state or union territory
|
||||
"""
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Enter an Indian state or territory.'),
|
||||
'invalid': _('Enter an Indian state or territory.'),
|
||||
}
|
||||
|
||||
def clean(self, value):
|
||||
super(INStateField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
try:
|
||||
value = value.strip().lower()
|
||||
except AttributeError:
|
||||
|
@ -106,10 +106,10 @@ class INPhoneNumberField(CharField):
|
|||
def clean(self, value):
|
||||
super(INPhoneNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
value = smart_unicode(value)
|
||||
m = phone_digits_re.match(value)
|
||||
if m:
|
||||
return u'%s' % (value)
|
||||
return '%s' % (value)
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Iceland specific form helpers.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django.contrib.localflavor.is_.is_postalcodes import IS_POSTALCODES
|
||||
from django.core.validators import EMPTY_VALUES
|
||||
|
@ -20,7 +20,7 @@ class ISIdNumberField(RegexField):
|
|||
"""
|
||||
default_error_messages = {
|
||||
'invalid': _('Enter a valid Icelandic identification number. The format is XXXXXX-XXXX.'),
|
||||
'checksum': _(u'The Icelandic identification number is not valid.'),
|
||||
'checksum': _('The Icelandic identification number is not valid.'),
|
||||
}
|
||||
|
||||
def __init__(self, max_length=11, min_length=10, *args, **kwargs):
|
||||
|
@ -31,7 +31,7 @@ class ISIdNumberField(RegexField):
|
|||
value = super(ISIdNumberField, self).clean(value)
|
||||
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
value = self._canonify(value)
|
||||
if self._validate(value):
|
||||
|
@ -73,7 +73,7 @@ class ISPhoneNumberField(RegexField):
|
|||
value = super(ISPhoneNumberField, self).clean(value)
|
||||
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
return value.replace('-', '').replace(' ', '')
|
||||
|
||||
|
|
|
@ -1,151 +1,152 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
IS_POSTALCODES = (
|
||||
('101', u'101 Reykjavík'),
|
||||
('103', u'103 Reykjavík'),
|
||||
('104', u'104 Reykjavík'),
|
||||
('105', u'105 Reykjavík'),
|
||||
('107', u'107 Reykjavík'),
|
||||
('108', u'108 Reykjavík'),
|
||||
('109', u'109 Reykjavík'),
|
||||
('110', u'110 Reykjavík'),
|
||||
('111', u'111 Reykjavík'),
|
||||
('112', u'112 Reykjavík'),
|
||||
('113', u'113 Reykjavík'),
|
||||
('116', u'116 Kjalarnes'),
|
||||
('121', u'121 Reykjavík'),
|
||||
('123', u'123 Reykjavík'),
|
||||
('124', u'124 Reykjavík'),
|
||||
('125', u'125 Reykjavík'),
|
||||
('127', u'127 Reykjavík'),
|
||||
('128', u'128 Reykjavík'),
|
||||
('129', u'129 Reykjavík'),
|
||||
('130', u'130 Reykjavík'),
|
||||
('132', u'132 Reykjavík'),
|
||||
('150', u'150 Reykjavík'),
|
||||
('155', u'155 Reykjavík'),
|
||||
('170', u'170 Seltjarnarnes'),
|
||||
('172', u'172 Seltjarnarnes'),
|
||||
('190', u'190 Vogar'),
|
||||
('200', u'200 Kópavogur'),
|
||||
('201', u'201 Kópavogur'),
|
||||
('202', u'202 Kópavogur'),
|
||||
('203', u'203 Kópavogur'),
|
||||
('210', u'210 Garðabær'),
|
||||
('212', u'212 Garðabær'),
|
||||
('220', u'220 Hafnarfjörður'),
|
||||
('221', u'221 Hafnarfjörður'),
|
||||
('222', u'222 Hafnarfjörður'),
|
||||
('225', u'225 Álftanes'),
|
||||
('230', u'230 Reykjanesbær'),
|
||||
('232', u'232 Reykjanesbær'),
|
||||
('233', u'233 Reykjanesbær'),
|
||||
('235', u'235 Keflavíkurflugvöllur'),
|
||||
('240', u'240 Grindavík'),
|
||||
('245', u'245 Sandgerði'),
|
||||
('250', u'250 Garður'),
|
||||
('260', u'260 Reykjanesbær'),
|
||||
('270', u'270 Mosfellsbær'),
|
||||
('300', u'300 Akranes'),
|
||||
('301', u'301 Akranes'),
|
||||
('302', u'302 Akranes'),
|
||||
('310', u'310 Borgarnes'),
|
||||
('311', u'311 Borgarnes'),
|
||||
('320', u'320 Reykholt í Borgarfirði'),
|
||||
('340', u'340 Stykkishólmur'),
|
||||
('345', u'345 Flatey á Breiðafirði'),
|
||||
('350', u'350 Grundarfjörður'),
|
||||
('355', u'355 Ólafsvík'),
|
||||
('356', u'356 Snæfellsbær'),
|
||||
('360', u'360 Hellissandur'),
|
||||
('370', u'370 Búðardalur'),
|
||||
('371', u'371 Búðardalur'),
|
||||
('380', u'380 Reykhólahreppur'),
|
||||
('400', u'400 Ísafjörður'),
|
||||
('401', u'401 Ísafjörður'),
|
||||
('410', u'410 Hnífsdalur'),
|
||||
('415', u'415 Bolungarvík'),
|
||||
('420', u'420 Súðavík'),
|
||||
('425', u'425 Flateyri'),
|
||||
('430', u'430 Suðureyri'),
|
||||
('450', u'450 Patreksfjörður'),
|
||||
('451', u'451 Patreksfjörður'),
|
||||
('460', u'460 Tálknafjörður'),
|
||||
('465', u'465 Bíldudalur'),
|
||||
('470', u'470 Þingeyri'),
|
||||
('471', u'471 Þingeyri'),
|
||||
('500', u'500 Staður'),
|
||||
('510', u'510 Hólmavík'),
|
||||
('512', u'512 Hólmavík'),
|
||||
('520', u'520 Drangsnes'),
|
||||
('522', u'522 Kjörvogur'),
|
||||
('523', u'523 Bær'),
|
||||
('524', u'524 Norðurfjörður'),
|
||||
('530', u'530 Hvammstangi'),
|
||||
('531', u'531 Hvammstangi'),
|
||||
('540', u'540 Blönduós'),
|
||||
('541', u'541 Blönduós'),
|
||||
('545', u'545 Skagaströnd'),
|
||||
('550', u'550 Sauðárkrókur'),
|
||||
('551', u'551 Sauðárkrókur'),
|
||||
('560', u'560 Varmahlíð'),
|
||||
('565', u'565 Hofsós'),
|
||||
('566', u'566 Hofsós'),
|
||||
('570', u'570 Fljót'),
|
||||
('580', u'580 Siglufjörður'),
|
||||
('600', u'600 Akureyri'),
|
||||
('601', u'601 Akureyri'),
|
||||
('602', u'602 Akureyri'),
|
||||
('603', u'603 Akureyri'),
|
||||
('610', u'610 Grenivík'),
|
||||
('611', u'611 Grímsey'),
|
||||
('620', u'620 Dalvík'),
|
||||
('621', u'621 Dalvík'),
|
||||
('625', u'625 Ólafsfjörður'),
|
||||
('630', u'630 Hrísey'),
|
||||
('640', u'640 Húsavík'),
|
||||
('641', u'641 Húsavík'),
|
||||
('645', u'645 Fosshóll'),
|
||||
('650', u'650 Laugar'),
|
||||
('660', u'660 Mývatn'),
|
||||
('670', u'670 Kópasker'),
|
||||
('671', u'671 Kópasker'),
|
||||
('675', u'675 Raufarhöfn'),
|
||||
('680', u'680 Þórshöfn'),
|
||||
('681', u'681 Þórshöfn'),
|
||||
('685', u'685 Bakkafjörður'),
|
||||
('690', u'690 Vopnafjörður'),
|
||||
('700', u'700 Egilsstaðir'),
|
||||
('701', u'701 Egilsstaðir'),
|
||||
('710', u'710 Seyðisfjörður'),
|
||||
('715', u'715 Mjóifjörður'),
|
||||
('720', u'720 Borgarfjörður eystri'),
|
||||
('730', u'730 Reyðarfjörður'),
|
||||
('735', u'735 Eskifjörður'),
|
||||
('740', u'740 Neskaupstaður'),
|
||||
('750', u'750 Fáskrúðsfjörður'),
|
||||
('755', u'755 Stöðvarfjörður'),
|
||||
('760', u'760 Breiðdalsvík'),
|
||||
('765', u'765 Djúpivogur'),
|
||||
('780', u'780 Höfn í Hornafirði'),
|
||||
('781', u'781 Höfn í Hornafirði'),
|
||||
('785', u'785 Öræfi'),
|
||||
('800', u'800 Selfoss'),
|
||||
('801', u'801 Selfoss'),
|
||||
('802', u'802 Selfoss'),
|
||||
('810', u'810 Hveragerði'),
|
||||
('815', u'815 Þorlákshöfn'),
|
||||
('820', u'820 Eyrarbakki'),
|
||||
('825', u'825 Stokkseyri'),
|
||||
('840', u'840 Laugarvatn'),
|
||||
('845', u'845 Flúðir'),
|
||||
('850', u'850 Hella'),
|
||||
('851', u'851 Hella'),
|
||||
('860', u'860 Hvolsvöllur'),
|
||||
('861', u'861 Hvolsvöllur'),
|
||||
('870', u'870 Vík'),
|
||||
('871', u'871 Vík'),
|
||||
('880', u'880 Kirkjubæjarklaustur'),
|
||||
('900', u'900 Vestmannaeyjar'),
|
||||
('902', u'902 Vestmannaeyjar')
|
||||
('101', '101 Reykjavík'),
|
||||
('103', '103 Reykjavík'),
|
||||
('104', '104 Reykjavík'),
|
||||
('105', '105 Reykjavík'),
|
||||
('107', '107 Reykjavík'),
|
||||
('108', '108 Reykjavík'),
|
||||
('109', '109 Reykjavík'),
|
||||
('110', '110 Reykjavík'),
|
||||
('111', '111 Reykjavík'),
|
||||
('112', '112 Reykjavík'),
|
||||
('113', '113 Reykjavík'),
|
||||
('116', '116 Kjalarnes'),
|
||||
('121', '121 Reykjavík'),
|
||||
('123', '123 Reykjavík'),
|
||||
('124', '124 Reykjavík'),
|
||||
('125', '125 Reykjavík'),
|
||||
('127', '127 Reykjavík'),
|
||||
('128', '128 Reykjavík'),
|
||||
('129', '129 Reykjavík'),
|
||||
('130', '130 Reykjavík'),
|
||||
('132', '132 Reykjavík'),
|
||||
('150', '150 Reykjavík'),
|
||||
('155', '155 Reykjavík'),
|
||||
('170', '170 Seltjarnarnes'),
|
||||
('172', '172 Seltjarnarnes'),
|
||||
('190', '190 Vogar'),
|
||||
('200', '200 Kópavogur'),
|
||||
('201', '201 Kópavogur'),
|
||||
('202', '202 Kópavogur'),
|
||||
('203', '203 Kópavogur'),
|
||||
('210', '210 Garðabær'),
|
||||
('212', '212 Garðabær'),
|
||||
('220', '220 Hafnarfjörður'),
|
||||
('221', '221 Hafnarfjörður'),
|
||||
('222', '222 Hafnarfjörður'),
|
||||
('225', '225 Álftanes'),
|
||||
('230', '230 Reykjanesbær'),
|
||||
('232', '232 Reykjanesbær'),
|
||||
('233', '233 Reykjanesbær'),
|
||||
('235', '235 Keflavíkurflugvöllur'),
|
||||
('240', '240 Grindavík'),
|
||||
('245', '245 Sandgerði'),
|
||||
('250', '250 Garður'),
|
||||
('260', '260 Reykjanesbær'),
|
||||
('270', '270 Mosfellsbær'),
|
||||
('300', '300 Akranes'),
|
||||
('301', '301 Akranes'),
|
||||
('302', '302 Akranes'),
|
||||
('310', '310 Borgarnes'),
|
||||
('311', '311 Borgarnes'),
|
||||
('320', '320 Reykholt í Borgarfirði'),
|
||||
('340', '340 Stykkishólmur'),
|
||||
('345', '345 Flatey á Breiðafirði'),
|
||||
('350', '350 Grundarfjörður'),
|
||||
('355', '355 Ólafsvík'),
|
||||
('356', '356 Snæfellsbær'),
|
||||
('360', '360 Hellissandur'),
|
||||
('370', '370 Búðardalur'),
|
||||
('371', '371 Búðardalur'),
|
||||
('380', '380 Reykhólahreppur'),
|
||||
('400', '400 Ísafjörður'),
|
||||
('401', '401 Ísafjörður'),
|
||||
('410', '410 Hnífsdalur'),
|
||||
('415', '415 Bolungarvík'),
|
||||
('420', '420 Súðavík'),
|
||||
('425', '425 Flateyri'),
|
||||
('430', '430 Suðureyri'),
|
||||
('450', '450 Patreksfjörður'),
|
||||
('451', '451 Patreksfjörður'),
|
||||
('460', '460 Tálknafjörður'),
|
||||
('465', '465 Bíldudalur'),
|
||||
('470', '470 Þingeyri'),
|
||||
('471', '471 Þingeyri'),
|
||||
('500', '500 Staður'),
|
||||
('510', '510 Hólmavík'),
|
||||
('512', '512 Hólmavík'),
|
||||
('520', '520 Drangsnes'),
|
||||
('522', '522 Kjörvogur'),
|
||||
('523', '523 Bær'),
|
||||
('524', '524 Norðurfjörður'),
|
||||
('530', '530 Hvammstangi'),
|
||||
('531', '531 Hvammstangi'),
|
||||
('540', '540 Blönduós'),
|
||||
('541', '541 Blönduós'),
|
||||
('545', '545 Skagaströnd'),
|
||||
('550', '550 Sauðárkrókur'),
|
||||
('551', '551 Sauðárkrókur'),
|
||||
('560', '560 Varmahlíð'),
|
||||
('565', '565 Hofsós'),
|
||||
('566', '566 Hofsós'),
|
||||
('570', '570 Fljót'),
|
||||
('580', '580 Siglufjörður'),
|
||||
('600', '600 Akureyri'),
|
||||
('601', '601 Akureyri'),
|
||||
('602', '602 Akureyri'),
|
||||
('603', '603 Akureyri'),
|
||||
('610', '610 Grenivík'),
|
||||
('611', '611 Grímsey'),
|
||||
('620', '620 Dalvík'),
|
||||
('621', '621 Dalvík'),
|
||||
('625', '625 Ólafsfjörður'),
|
||||
('630', '630 Hrísey'),
|
||||
('640', '640 Húsavík'),
|
||||
('641', '641 Húsavík'),
|
||||
('645', '645 Fosshóll'),
|
||||
('650', '650 Laugar'),
|
||||
('660', '660 Mývatn'),
|
||||
('670', '670 Kópasker'),
|
||||
('671', '671 Kópasker'),
|
||||
('675', '675 Raufarhöfn'),
|
||||
('680', '680 Þórshöfn'),
|
||||
('681', '681 Þórshöfn'),
|
||||
('685', '685 Bakkafjörður'),
|
||||
('690', '690 Vopnafjörður'),
|
||||
('700', '700 Egilsstaðir'),
|
||||
('701', '701 Egilsstaðir'),
|
||||
('710', '710 Seyðisfjörður'),
|
||||
('715', '715 Mjóifjörður'),
|
||||
('720', '720 Borgarfjörður eystri'),
|
||||
('730', '730 Reyðarfjörður'),
|
||||
('735', '735 Eskifjörður'),
|
||||
('740', '740 Neskaupstaður'),
|
||||
('750', '750 Fáskrúðsfjörður'),
|
||||
('755', '755 Stöðvarfjörður'),
|
||||
('760', '760 Breiðdalsvík'),
|
||||
('765', '765 Djúpivogur'),
|
||||
('780', '780 Höfn í Hornafirði'),
|
||||
('781', '781 Höfn í Hornafirði'),
|
||||
('785', '785 Öræfi'),
|
||||
('800', '800 Selfoss'),
|
||||
('801', '801 Selfoss'),
|
||||
('802', '802 Selfoss'),
|
||||
('810', '810 Hveragerði'),
|
||||
('815', '815 Þorlákshöfn'),
|
||||
('820', '820 Eyrarbakki'),
|
||||
('825', '825 Stokkseyri'),
|
||||
('840', '840 Laugarvatn'),
|
||||
('845', '845 Flúðir'),
|
||||
('850', '850 Hella'),
|
||||
('851', '851 Hella'),
|
||||
('860', '860 Hvolsvöllur'),
|
||||
('861', '861 Hvolsvöllur'),
|
||||
('870', '870 Vík'),
|
||||
('871', '871 Vík'),
|
||||
('880', '880 Kirkjubæjarklaustur'),
|
||||
('900', '900 Vestmannaeyjar'),
|
||||
('902', '902 Vestmannaeyjar')
|
||||
)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
IT-specific Form helpers
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
|
@ -45,7 +45,7 @@ class ITSocialSecurityNumberField(RegexField):
|
|||
'Informazioni sulla codificazione delle persone fisiche'.
|
||||
"""
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Enter a valid Social Security number.'),
|
||||
'invalid': _('Enter a valid Social Security number.'),
|
||||
}
|
||||
|
||||
def __init__(self, max_length=None, min_length=None, *args, **kwargs):
|
||||
|
@ -55,8 +55,8 @@ class ITSocialSecurityNumberField(RegexField):
|
|||
def clean(self, value):
|
||||
value = super(ITSocialSecurityNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
value = re.sub('\s', u'', value).upper()
|
||||
return ''
|
||||
value = re.sub('\s', '', value).upper()
|
||||
try:
|
||||
check_digit = ssn_check_digit(value)
|
||||
except ValueError:
|
||||
|
@ -70,13 +70,13 @@ class ITVatNumberField(Field):
|
|||
A form field that validates Italian VAT numbers (partita IVA).
|
||||
"""
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Enter a valid VAT number.'),
|
||||
'invalid': _('Enter a valid VAT number.'),
|
||||
}
|
||||
|
||||
def clean(self, value):
|
||||
value = super(ITVatNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
try:
|
||||
vat_number = int(value)
|
||||
except ValueError:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# -*- coding: utf-8 -*
|
||||
from __future__ import unicode_literals
|
||||
|
||||
PROVINCE_CHOICES = (
|
||||
('AG', 'Agrigento'),
|
||||
|
@ -45,7 +46,7 @@ PROVINCE_CHOICES = (
|
|||
('IM', 'Imperia'),
|
||||
('IS', 'Isernia'),
|
||||
('SP', 'La Spezia'),
|
||||
('AQ', u'L’Aquila'),
|
||||
('AQ', 'L’Aquila'),
|
||||
('LT', 'Latina'),
|
||||
('LE', 'Lecce'),
|
||||
('LC', 'Lecco'),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# -*- coding: utf-8 -*
|
||||
from __future__ import unicode_literals
|
||||
|
||||
REGION_CHOICES = (
|
||||
('ABR', 'Abruzzo'),
|
||||
|
@ -19,6 +20,6 @@ REGION_CHOICES = (
|
|||
('TOS', 'Toscana'),
|
||||
('TAA', 'Trentino-Alto Adige'),
|
||||
('UMB', 'Umbria'),
|
||||
('VAO', u'Valle d’Aosta'),
|
||||
('VAO', 'Valle d’Aosta'),
|
||||
('VEN', 'Veneto'),
|
||||
)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.utils.encoding import smart_str, smart_unicode
|
||||
from django.utils.encoding import smart_unicode
|
||||
|
||||
def ssn_check_digit(value):
|
||||
"Calculate Italian social security number check digit."
|
||||
|
@ -34,7 +34,7 @@ def ssn_check_digit(value):
|
|||
|
||||
def vat_number_check_digit(vat_number):
|
||||
"Calculate Italian VAT number check digit."
|
||||
normalized_vat_number = smart_str(vat_number).zfill(10)
|
||||
normalized_vat_number = smart_unicode(vat_number).zfill(10)
|
||||
total = 0
|
||||
for i in range(0, 10, 2):
|
||||
total += int(normalized_vat_number[i])
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
"""
|
||||
Kuwait-specific Form helpers
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
from datetime import date
|
||||
|
||||
|
@ -40,7 +42,7 @@ class KWCivilIDNumberField(Field):
|
|||
def clean(self, value):
|
||||
super(KWCivilIDNumberField, self).clean(value)
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
if not re.match(r'^\d{12}$', value):
|
||||
raise ValidationError(self.error_messages['invalid'])
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import datetime
|
||||
|
||||
|
@ -15,14 +15,14 @@ class MKIdentityCardNumberField(RegexField):
|
|||
A Macedonian ID card number. Accepts both old and new format.
|
||||
"""
|
||||
default_error_messages = {
|
||||
'invalid': _(u'Identity card numbers must contain'
|
||||
'invalid': _('Identity card numbers must contain'
|
||||
' either 4 to 7 digits or an uppercase letter and 7 digits.'),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
kwargs['min_length'] = None
|
||||
kwargs['max_length'] = 8
|
||||
regex = ur'(^[A-Z]{1}\d{7}$)|(^\d{4,7}$)'
|
||||
regex = r'(^[A-Z]{1}\d{7}$)|(^\d{4,7}$)'
|
||||
super(MKIdentityCardNumberField, self).__init__(regex, *args, **kwargs)
|
||||
|
||||
|
||||
|
@ -54,9 +54,9 @@ class UMCNField(RegexField):
|
|||
* The last digit of the UMCN passes a checksum test
|
||||
"""
|
||||
default_error_messages = {
|
||||
'invalid': _(u'This field should contain exactly 13 digits.'),
|
||||
'date': _(u'The first 7 digits of the UMCN must represent a valid past date.'),
|
||||
'checksum': _(u'The UMCN is not valid.'),
|
||||
'invalid': _('This field should contain exactly 13 digits.'),
|
||||
'date': _('The first 7 digits of the UMCN must represent a valid past date.'),
|
||||
'checksum': _('The UMCN is not valid.'),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -68,7 +68,7 @@ class UMCNField(RegexField):
|
|||
value = super(UMCNField, self).clean(value)
|
||||
|
||||
if value in EMPTY_VALUES:
|
||||
return u''
|
||||
return ''
|
||||
|
||||
if not self._validate_date_part(value):
|
||||
raise ValidationError(self.error_messages['date'])
|
||||
|
|
|
@ -2,91 +2,93 @@
|
|||
"""
|
||||
Macedonian municipalities per the reorganization from 2004.
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
MK_MUNICIPALITIES = (
|
||||
('AD', _(u'Aerodrom')),
|
||||
('AR', _(u'Aračinovo')),
|
||||
('BR', _(u'Berovo')),
|
||||
('TL', _(u'Bitola')),
|
||||
('BG', _(u'Bogdanci')),
|
||||
('VJ', _(u'Bogovinje')),
|
||||
('BS', _(u'Bosilovo')),
|
||||
('BN', _(u'Brvenica')),
|
||||
('BU', _(u'Butel')),
|
||||
('VA', _(u'Valandovo')),
|
||||
('VL', _(u'Vasilevo')),
|
||||
('VV', _(u'Vevčani')),
|
||||
('VE', _(u'Veles')),
|
||||
('NI', _(u'Vinica')),
|
||||
('VC', _(u'Vraneštica')),
|
||||
('VH', _(u'Vrapčište')),
|
||||
('GB', _(u'Gazi Baba')),
|
||||
('GV', _(u'Gevgelija')),
|
||||
('GT', _(u'Gostivar')),
|
||||
('GR', _(u'Gradsko')),
|
||||
('DB', _(u'Debar')),
|
||||
('DA', _(u'Debarca')),
|
||||
('DL', _(u'Delčevo')),
|
||||
('DK', _(u'Demir Kapija')),
|
||||
('DM', _(u'Demir Hisar')),
|
||||
('DE', _(u'Dolneni')),
|
||||
('DR', _(u'Drugovo')),
|
||||
('GP', _(u'Gjorče Petrov')),
|
||||
('ZE', _(u'Želino')),
|
||||
('ZA', _(u'Zajas')),
|
||||
('ZK', _(u'Zelenikovo')),
|
||||
('ZR', _(u'Zrnovci')),
|
||||
('IL', _(u'Ilinden')),
|
||||
('JG', _(u'Jegunovce')),
|
||||
('AV', _(u'Kavadarci')),
|
||||
('KB', _(u'Karbinci')),
|
||||
('KX', _(u'Karpoš')),
|
||||
('VD', _(u'Kisela Voda')),
|
||||
('KH', _(u'Kičevo')),
|
||||
('KN', _(u'Konče')),
|
||||
('OC', _(u'Koćani')),
|
||||
('KY', _(u'Kratovo')),
|
||||
('KZ', _(u'Kriva Palanka')),
|
||||
('KG', _(u'Krivogaštani')),
|
||||
('KS', _(u'Kruševo')),
|
||||
('UM', _(u'Kumanovo')),
|
||||
('LI', _(u'Lipkovo')),
|
||||
('LO', _(u'Lozovo')),
|
||||
('MR', _(u'Mavrovo i Rostuša')),
|
||||
('MK', _(u'Makedonska Kamenica')),
|
||||
('MD', _(u'Makedonski Brod')),
|
||||
('MG', _(u'Mogila')),
|
||||
('NG', _(u'Negotino')),
|
||||
('NV', _(u'Novaci')),
|
||||
('NS', _(u'Novo Selo')),
|
||||
('OS', _(u'Oslomej')),
|
||||
('OD', _(u'Ohrid')),
|
||||
('PE', _(u'Petrovec')),
|
||||
('PH', _(u'Pehčevo')),
|
||||
('PN', _(u'Plasnica')),
|
||||
('PP', _(u'Prilep')),
|
||||
('PT', _(u'Probištip')),
|
||||
('RV', _(u'Radoviš')),
|
||||
('RN', _(u'Rankovce')),
|
||||
('RE', _(u'Resen')),
|
||||
('RO', _(u'Rosoman')),
|
||||
('AJ', _(u'Saraj')),
|
||||
('SL', _(u'Sveti Nikole')),
|
||||
('SS', _(u'Sopište')),
|
||||
('SD', _(u'Star Dojran')),
|
||||
('NA', _(u'Staro Nagoričane')),
|
||||
('UG', _(u'Struga')),
|
||||
('RU', _(u'Strumica')),
|
||||
('SU', _(u'Studeničani')),
|
||||
('TR', _(u'Tearce')),
|
||||
('ET', _(u'Tetovo')),
|
||||
('CE', _(u'Centar')),
|
||||
('CZ', _(u'Centar-Župa')),
|
||||
('CI', _(u'Čair')),
|
||||
('CA', _(u'Čaška')),
|
||||
('CH', _(u'Češinovo-Obleševo')),
|
||||
('CS', _(u'Čučer-Sandevo')),
|
||||
('ST', _(u'Štip')),
|
||||
('SO', _(u'Šuto Orizari')),
|
||||
('AD', _('Aerodrom')),
|
||||
('AR', _('Aračinovo')),
|
||||
('BR', _('Berovo')),
|
||||
('TL', _('Bitola')),
|
||||
('BG', _('Bogdanci')),
|
||||
('VJ', _('Bogovinje')),
|
||||
('BS', _('Bosilovo')),
|
||||
('BN', _('Brvenica')),
|
||||
('BU', _('Butel')),
|
||||
('VA', _('Valandovo')),
|
||||
('VL', _('Vasilevo')),
|
||||
('VV', _('Vevčani')),
|
||||
('VE', _('Veles')),
|
||||
('NI', _('Vinica')),
|
||||
('VC', _('Vraneštica')),
|
||||
('VH', _('Vrapčište')),
|
||||
('GB', _('Gazi Baba')),
|
||||
('GV', _('Gevgelija')),
|
||||
('GT', _('Gostivar')),
|
||||
('GR', _('Gradsko')),
|
||||
('DB', _('Debar')),
|
||||
('DA', _('Debarca')),
|
||||
('DL', _('Delčevo')),
|
||||
('DK', _('Demir Kapija')),
|
||||
('DM', _('Demir Hisar')),
|
||||
('DE', _('Dolneni')),
|
||||
('DR', _('Drugovo')),
|
||||
('GP', _('Gjorče Petrov')),
|
||||
('ZE', _('Želino')),
|
||||
('ZA', _('Zajas')),
|
||||
('ZK', _('Zelenikovo')),
|
||||
('ZR', _('Zrnovci')),
|
||||
('IL', _('Ilinden')),
|
||||
('JG', _('Jegunovce')),
|
||||
('AV', _('Kavadarci')),
|
||||
('KB', _('Karbinci')),
|
||||
('KX', _('Karpoš')),
|
||||
('VD', _('Kisela Voda')),
|
||||
('KH', _('Kičevo')),
|
||||
('KN', _('Konče')),
|
||||
('OC', _('Koćani')),
|
||||
('KY', _('Kratovo')),
|
||||
('KZ', _('Kriva Palanka')),
|
||||
('KG', _('Krivogaštani')),
|
||||
('KS', _('Kruševo')),
|
||||
('UM', _('Kumanovo')),
|
||||
('LI', _('Lipkovo')),
|
||||
('LO', _('Lozovo')),
|
||||
('MR', _('Mavrovo i Rostuša')),
|
||||
('MK', _('Makedonska Kamenica')),
|
||||
('MD', _('Makedonski Brod')),
|
||||
('MG', _('Mogila')),
|
||||
('NG', _('Negotino')),
|
||||
('NV', _('Novaci')),
|
||||
('NS', _('Novo Selo')),
|
||||
('OS', _('Oslomej')),
|
||||
('OD', _('Ohrid')),
|
||||
('PE', _('Petrovec')),
|
||||
('PH', _('Pehčevo')),
|
||||
('PN', _('Plasnica')),
|
||||
('PP', _('Prilep')),
|
||||
('PT', _('Probištip')),
|
||||
('RV', _('Radoviš')),
|
||||
('RN', _('Rankovce')),
|
||||
('RE', _('Resen')),
|
||||
('RO', _('Rosoman')),
|
||||
('AJ', _('Saraj')),
|
||||
('SL', _('Sveti Nikole')),
|
||||
('SS', _('Sopište')),
|
||||
('SD', _('Star Dojran')),
|
||||
('NA', _('Staro Nagoričane')),
|
||||
('UG', _('Struga')),
|
||||
('RU', _('Strumica')),
|
||||
('SU', _('Studeničani')),
|
||||
('TR', _('Tearce')),
|
||||
('ET', _('Tetovo')),
|
||||
('CE', _('Centar')),
|
||||
('CZ', _('Centar-Župa')),
|
||||
('CI', _('Čair')),
|
||||
('CA', _('Čaška')),
|
||||
('CH', _('Češinovo-Obleševo')),
|
||||
('CS', _('Čučer-Sandevo')),
|
||||
('ST', _('Štip')),
|
||||
('SO', _('Šuto Orizari')),
|
||||
)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue