Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #16202 -- Added a Slovenian localflavor. Thanks to Jure Cuhalev…

… < gandalf@owca.info>, Gasper Zejn and Domen Kozar for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16706 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6757568bfa5a34ec7b6e6b833612fc007b31a339 1 parent 93fbb77
Julien Phalip authored August 28, 2011
164  django/contrib/localflavor/si/forms.py
... ...
@@ -0,0 +1,164 @@
  1
+"""
  2
+Slovenian specific form helpers.
  3
+"""
  4
+
  5
+import datetime
  6
+import re
  7
+
  8
+from django.forms.fields import CharField, Select, ChoiceField
  9
+from django.core.validators import EMPTY_VALUES
  10
+from django.forms import ValidationError
  11
+from django.utils.translation import ugettext_lazy as _
  12
+
  13
+
  14
+class SIEMSOField(CharField):
  15
+    """A form for validating Slovenian personal identification number.
  16
+
  17
+    Additionally stores gender, nationality and birthday to self.info dictionary.
  18
+    """
  19
+
  20
+    default_error_messages = {
  21
+        'invalid': _(u'This field should contain exactly 13 digits.'),
  22
+        'date': _(u'The first 7 digits of the EMSO must represent a valid past date.'),
  23
+        'checksum': _(u'The EMSO is not valid.'),
  24
+    }
  25
+    emso_regex = re.compile('^(\d{2})(\d{2})(\d{3})(\d{2})(\d{3})(\d)$')
  26
+
  27
+    def clean(self, value):
  28
+        super(SIEMSOField, self).clean(value)
  29
+        if value in EMPTY_VALUES:
  30
+            return u''
  31
+
  32
+        value = value.strip()
  33
+
  34
+        m = self.emso_regex.match(value)
  35
+        if m is None:
  36
+            raise ValidationError(self.default_error_messages['invalid'])
  37
+
  38
+        # Validate EMSO
  39
+        s = 0
  40
+        int_values = [int(i) for i in value]
  41
+        for a, b in zip(int_values, range(7, 1, -1) * 2):
  42
+            s += a * b
  43
+        chk = s % 11
  44
+        if chk == 0:
  45
+            K = 0
  46
+        else:
  47
+            K = 11 - chk
  48
+
  49
+        if K == 10 or int_values[-1] != K:
  50
+            raise ValidationError(self.default_error_messages['checksum'])
  51
+
  52
+        # Extract extra info in the identification number
  53
+        day, month, year, nationality, gender, chksum = [int(i) for i in m.groups()]
  54
+
  55
+        if year < 890:
  56
+            year += 2000
  57
+        else:
  58
+            year += 1000
  59
+
  60
+        # validate birthday
  61
+        try:
  62
+            birthday = datetime.date(year, month, day)
  63
+        except ValueError:
  64
+            raise ValidationError(self.error_messages['date'])
  65
+        if datetime.date.today() < birthday:
  66
+            raise ValidationError(self.error_messages['date'])
  67
+
  68
+        self.info = {
  69
+            'gender': gender < 500 and 'male' or 'female',
  70
+            'birthdate': birthday,
  71
+            'nationality': nationality,
  72
+        }
  73
+        return value
  74
+
  75
+
  76
+class SITaxNumberField(CharField):
  77
+    """Slovenian tax number field.
  78
+
  79
+    Valid input is SIXXXXXXXX or XXXXXXXX where X is a number.
  80
+    """
  81
+
  82
+    default_error_messages = {
  83
+        'invalid': _(u'Enter a valid tax number in form SIXXXXXXXX'),
  84
+    }
  85
+    sitax_regex = re.compile('^(?:SI)?([1-9]\d{7})$')
  86
+
  87
+    def clean(self, value):
  88
+        super(SITaxNumberField, self).clean(value)
  89
+        if value in EMPTY_VALUES:
  90
+            return u''
  91
+
  92
+        value = value.strip()
  93
+
  94
+        m = self.sitax_regex.match(value)
  95
+        if m is None:
  96
+            raise ValidationError(self.default_error_messages['invalid'])
  97
+        value = m.groups()[0]
  98
+
  99
+        # Validate Tax number
  100
+        s = 0
  101
+        int_values = [int(i) for i in value]
  102
+        for a, b in zip(int_values, range(8, 1, -1)):
  103
+            s += a * b
  104
+        chk = 11 - (s % 11)
  105
+        if chk == 10:
  106
+            chk = 0
  107
+
  108
+        if int_values[-1] != chk:
  109
+            raise ValidationError(self.default_error_messages['invalid'])
  110
+
  111
+        return value
  112
+
  113
+
  114
+class SIPostalCodeField(ChoiceField):
  115
+    """Slovenian post codes field.
  116
+    """
  117
+
  118
+    def __init__(self, *args, **kwargs):
  119
+        from si_postalcodes import SI_POSTALCODES_CHOICES
  120
+        kwargs.setdefault('choices', SI_POSTALCODES_CHOICES)
  121
+        super(SIPostalCodeField, self).__init__(*args, **kwargs)
  122
+
  123
+
  124
+class SIPostalCodeSelect(Select):
  125
+    """A Select widget that uses Slovenian postal codes as its choices.
  126
+    """
  127
+    def __init__(self, attrs=None):
  128
+        from si_postalcodes import SI_POSTALCODES_CHOICES
  129
+        super(SIPostalCodeSelect, self).__init__(attrs,
  130
+            choices=SI_POSTALCODES_CHOICES)
  131
+
  132
+
  133
+class SIPhoneNumberField(CharField):
  134
+    """Slovenian phone number field.
  135
+
  136
+    Phone number must contain at least local area code.
  137
+    Country code can be present.
  138
+
  139
+    Examples:
  140
+
  141
+    * +38640XXXXXX
  142
+    * 0038640XXXXXX
  143
+    * 040XXXXXX
  144
+    * 01XXXXXX
  145
+    * 0590XXXXX
  146
+
  147
+    """
  148
+
  149
+    default_error_messages = {
  150
+        'invalid': _(u'Enter phone number in form +386XXXXXXXX or 0XXXXXXXX.'),
  151
+    }
  152
+    phone_regex = re.compile('^(?:(?:00|\+)386|0)(\d{7,8})$')
  153
+
  154
+    def clean(self, value):
  155
+        super(SIPhoneNumberField, self).clean(value)
  156
+        if value in EMPTY_VALUES:
  157
+            return u''
  158
+
  159
+        value = value.replace(' ', '').replace('-', '').replace('/', '')
  160
+        m = self.phone_regex.match(value)
  161
+
  162
+        if m is None:
  163
+            raise ValidationError(self.default_error_messages['invalid'])
  164
+        return m.groups()[0]
468  django/contrib/localflavor/si/si_postalcodes.py
... ...
@@ -0,0 +1,468 @@
  1
+# *-* coding: utf-8 *-*
  2
+
  3
+SI_POSTALCODES = [
  4
+ (1000, u'Ljubljana'),
  5
+ (1215, u'Medvode'),
  6
+ (1216, u'Smlednik'),
  7
+ (1217, u'Vodice'),
  8
+ (1218, u'Komenda'),
  9
+ (1219, u'Laze v Tuhinju'),
  10
+ (1221, u'Motnik'),
  11
+ (1222, u'Trojane'),
  12
+ (1223, u'Blagovica'),
  13
+ (1225, u'Lukovica'),
  14
+ (1230, u'Dom\u017eale'),
  15
+ (1233, u'Dob'),
  16
+ (1234, u'Menge\u0161'),
  17
+ (1235, u'Radomlje'),
  18
+ (1236, u'Trzin'),
  19
+ (1241, u'Kamnik'),
  20
+ (1242, u'Stahovica'),
  21
+ (1251, u'Morav\u010de'),
  22
+ (1252, u'Va\u010de'),
  23
+ (1262, u'Dol pri Ljubljani'),
  24
+ (1270, u'Litija'),
  25
+ (1272, u'Pol\u0161nik'),
  26
+ (1273, u'Dole pri Litiji'),
  27
+ (1274, u'Gabrovka'),
  28
+ (1275, u'\u0160martno pri Litiji'),
  29
+ (1276, u'Primskovo'),
  30
+ (1281, u'Kresnice'),
  31
+ (1282, u'Sava'),
  32
+ (1290, u'Grosuplje'),
  33
+ (1291, u'\u0160kofljica'),
  34
+ (1292, u'Ig'),
  35
+ (1293, u'\u0160marje - Sap'),
  36
+ (1294, u'Vi\u0161nja Gora'),
  37
+ (1295, u'Ivan\u010dna Gorica'),
  38
+ (1296, u'\u0160entvid pri Sti\u010dni'),
  39
+ (1301, u'Krka'),
  40
+ (1303, u'Zagradec'),
  41
+ (1310, u'Ribnica'),
  42
+ (1311, u'Turjak'),
  43
+ (1312, u'Videm - Dobrepolje'),
  44
+ (1313, u'Struge'),
  45
+ (1314, u'Rob'),
  46
+ (1315, u'Velike La\u0161\u010de'),
  47
+ (1316, u'Ortnek'),
  48
+ (1317, u'Sodra\u017eica'),
  49
+ (1318, u'Lo\u0161ki Potok'),
  50
+ (1319, u'Draga'),
  51
+ (1330, u'Ko\u010devje'),
  52
+ (1331, u'Dolenja vas'),
  53
+ (1332, u'Stara Cerkev'),
  54
+ (1336, u'Kostel'),
  55
+ (1337, u'Osilnica'),
  56
+ (1338, u'Ko\u010devska Reka'),
  57
+ (1351, u'Brezovica pri Ljubljani'),
  58
+ (1352, u'Preserje'),
  59
+ (1353, u'Borovnica'),
  60
+ (1354, u'Horjul'),
  61
+ (1355, u'Polhov Gradec'),
  62
+ (1356, u'Dobrova'),
  63
+ (1357, u'Notranje Gorice'),
  64
+ (1358, u'Log pri Brezovici'),
  65
+ (1360, u'Vrhnika'),
  66
+ (1370, u'Logatec'),
  67
+ (1372, u'Hotedr\u0161ica'),
  68
+ (1373, u'Rovte'),
  69
+ (1380, u'Cerknica'),
  70
+ (1381, u'Rakek'),
  71
+ (1382, u'Begunje pri Cerknici'),
  72
+ (1384, u'Grahovo'),
  73
+ (1385, u'Nova vas'),
  74
+ (1386, u'Stari trg pri Lo\u017eu'),
  75
+ (1410, u'Zagorje ob Savi'),
  76
+ (1411, u'Izlake'),
  77
+ (1412, u'Kisovec'),
  78
+ (1413, u'\u010cem\u0161enik'),
  79
+ (1414, u'Podkum'),
  80
+ (1420, u'Trbovlje'),
  81
+ (1423, u'Dobovec'),
  82
+ (1430, u'Hrastnik'),
  83
+ (1431, u'Dol pri Hrastniku'),
  84
+ (1432, u'Zidani Most'),
  85
+ (1433, u'Rade\u010de'),
  86
+ (1434, u'Loka pri Zidanem Mostu'),
  87
+ (2000, u'Maribor'),
  88
+ (2201, u'Zgornja Kungota'),
  89
+ (2204, u'Miklav\u017e na Dravskem polju'),
  90
+ (2205, u'Star\u0161e'),
  91
+ (2206, u'Marjeta na Dravskem polju'),
  92
+ (2208, u'Pohorje'),
  93
+ (2211, u'Pesnica pri Mariboru'),
  94
+ (2212, u'\u0160entilj v Slovenskih goricah'),
  95
+ (2213, u'Zgornja Velka'),
  96
+ (2214, u'Sladki vrh'),
  97
+ (2215, u'Cer\u0161ak'),
  98
+ (2221, u'Jarenina'),
  99
+ (2222, u'Jakobski Dol'),
  100
+ (2223, u'Jurovski Dol'),
  101
+ (2229, u'Male\u010dnik'),
  102
+ (2230, u'Lenart v Slovenskih goricah'),
  103
+ (2231, u'Pernica'),
  104
+ (2232, u'Voli\u010dina'),
  105
+ (2233, u'Sveta Ana v Slovenskih goricah'),
  106
+ (2234, u'Benedikt'),
  107
+ (2235, u'Sveta Trojica v Slovenskih goricah'),
  108
+ (2236, u'Cerkvenjak'),
  109
+ (2241, u'Spodnji Duplek'),
  110
+ (2242, u'Zgornja Korena'),
  111
+ (2250, u'Ptuj'),
  112
+ (2252, u'Dornava'),
  113
+ (2253, u'Destrnik'),
  114
+ (2254, u'Trnovska vas'),
  115
+ (2255, u'Vitomarci'),
  116
+ (2256, u'Jur\u0161inci'),
  117
+ (2257, u'Polen\u0161ak'),
  118
+ (2258, u'Sveti Toma\u017e'),
  119
+ (2259, u'Ivanjkovci'),
  120
+ (2270, u'Ormo\u017e'),
  121
+ (2272, u'Gori\u0161nica'),
  122
+ (2273, u'Podgorci'),
  123
+ (2274, u'Velika Nedelja'),
  124
+ (2275, u'Miklav\u017e pri Ormo\u017eu'),
  125
+ (2276, u'Kog'),
  126
+ (2277, u'Sredi\u0161\u010de ob Dravi'),
  127
+ (2281, u'Markovci'),
  128
+ (2282, u'Cirkulane'),
  129
+ (2283, u'Zavr\u010d'),
  130
+ (2284, u'Videm pri Ptuju'),
  131
+ (2285, u'Zgornji Leskovec'),
  132
+ (2286, u'Podlehnik'),
  133
+ (2287, u'\u017detale'),
  134
+ (2288, u'Hajdina'),
  135
+ (2289, u'Stoperce'),
  136
+ (2310, u'Slovenska Bistrica'),
  137
+ (2311, u'Ho\u010de'),
  138
+ (2312, u'Orehova vas'),
  139
+ (2313, u'Fram'),
  140
+ (2314, u'Zgornja Polskava'),
  141
+ (2315, u'\u0160martno na Pohorju'),
  142
+ (2316, u'Zgornja Lo\u017enica'),
  143
+ (2317, u'Oplotnica'),
  144
+ (2318, u'Laporje'),
  145
+ (2319, u'Polj\u010dane'),
  146
+ (2321, u'Makole'),
  147
+ (2322, u'Maj\u0161perk'),
  148
+ (2323, u'Ptujska Gora'),
  149
+ (2324, u'Lovrenc na Dravskem polju'),
  150
+ (2325, u'Kidri\u010devo'),
  151
+ (2326, u'Cirkovce'),
  152
+ (2327, u'Ra\u010de'),
  153
+ (2331, u'Pragersko'),
  154
+ (2341, u'Limbu\u0161'),
  155
+ (2342, u'Ru\u0161e'),
  156
+ (2343, u'Fala'),
  157
+ (2344, u'Lovrenc na Pohorju'),
  158
+ (2345, u'Bistrica ob Dravi'),
  159
+ (2351, u'Kamnica'),
  160
+ (2352, u'Selnica ob Dravi'),
  161
+ (2353, u'Sv. Duh na Ostrem Vrhu'),
  162
+ (2354, u'Bresternica'),
  163
+ (2360, u'Radlje ob Dravi'),
  164
+ (2361, u'O\u017ebalt'),
  165
+ (2362, u'Kapla'),
  166
+ (2363, u'Podvelka'),
  167
+ (2364, u'Ribnica na Pohorju'),
  168
+ (2365, u'Vuhred'),
  169
+ (2366, u'Muta'),
  170
+ (2367, u'Vuzenica'),
  171
+ (2370, u'Dravograd'),
  172
+ (2371, u'Trbonje'),
  173
+ (2372, u'Libeli\u010de'),
  174
+ (2373, u'\u0160entjan\u017e pri Dravogradu'),
  175
+ (2380, u'Slovenj Gradec'),
  176
+ (2381, u'Podgorje pri Slovenj Gradcu'),
  177
+ (2382, u'Mislinja'),
  178
+ (2383, u'\u0160martno pri Slovenj Gradcu'),
  179
+ (2390, u'Ravne na Koro\u0161kem'),
  180
+ (2391, u'Prevalje'),
  181
+ (2392, u'Me\u017eica'),
  182
+ (2393, u'\u010crna na Koro\u0161kem'),
  183
+ (2394, u'Kotlje'),
  184
+ (3000, u'Celje'),
  185
+ (3201, u'\u0160martno v Ro\u017eni dolini'),
  186
+ (3202, u'Ljube\u010dna'),
  187
+ (3203, u'Nova Cerkev'),
  188
+ (3204, u'Dobrna'),
  189
+ (3205, u'Vitanje'),
  190
+ (3206, u'Stranice'),
  191
+ (3210, u'Slovenske Konjice'),
  192
+ (3211, u'\u0160kofja vas'),
  193
+ (3212, u'Vojnik'),
  194
+ (3213, u'Frankolovo'),
  195
+ (3214, u'Zre\u010de'),
  196
+ (3215, u'Lo\u010de'),
  197
+ (3220, u'\u0160tore'),
  198
+ (3221, u'Teharje'),
  199
+ (3222, u'Dramlje'),
  200
+ (3223, u'Loka pri \u017dusmu'),
  201
+ (3224, u'Dobje pri Planini'),
  202
+ (3225, u'Planina pri Sevnici'),
  203
+ (3230, u'\u0160entjur'),
  204
+ (3231, u'Grobelno'),
  205
+ (3232, u'Ponikva'),
  206
+ (3233, u'Kalobje'),
  207
+ (3240, u'\u0160marje pri Jel\u0161ah'),
  208
+ (3241, u'Podplat'),
  209
+ (3250, u'Roga\u0161ka Slatina'),
  210
+ (3252, u'Rogatec'),
  211
+ (3253, u'Pristava pri Mestinju'),
  212
+ (3254, u'Pod\u010detrtek'),
  213
+ (3255, u'Bu\u010de'),
  214
+ (3256, u'Bistrica ob Sotli'),
  215
+ (3257, u'Podsreda'),
  216
+ (3260, u'Kozje'),
  217
+ (3261, u'Lesi\u010dno'),
  218
+ (3262, u'Prevorje'),
  219
+ (3263, u'Gorica pri Slivnici'),
  220
+ (3264, u'Sveti \u0160tefan'),
  221
+ (3270, u'La\u0161ko'),
  222
+ (3271, u'\u0160entrupert'),
  223
+ (3272, u'Rimske Toplice'),
  224
+ (3273, u'Jurklo\u0161ter'),
  225
+ (3301, u'Petrov\u010de'),
  226
+ (3302, u'Gri\u017ee'),
  227
+ (3303, u'Gomilsko'),
  228
+ (3304, u'Tabor'),
  229
+ (3305, u'Vransko'),
  230
+ (3310, u'\u017dalec'),
  231
+ (3311, u'\u0160empeter v Savinjski dolini'),
  232
+ (3312, u'Prebold'),
  233
+ (3313, u'Polzela'),
  234
+ (3314, u'Braslov\u010de'),
  235
+ (3320, u'Velenje - dostava'),
  236
+ (3322, u'Velenje - po\u0161tni predali'),
  237
+ (3325, u'\u0160o\u0161tanj'),
  238
+ (3326, u'Topol\u0161ica'),
  239
+ (3327, u'\u0160martno ob Paki'),
  240
+ (3330, u'Mozirje'),
  241
+ (3331, u'Nazarje'),
  242
+ (3332, u'Re\u010dica ob Savinji'),
  243
+ (3333, u'Ljubno ob Savinji'),
  244
+ (3334, u'Lu\u010de'),
  245
+ (3335, u'Sol\u010dava'),
  246
+ (3341, u'\u0160martno ob Dreti'),
  247
+ (3342, u'Gornji Grad'),
  248
+ (4000, u'Kranj'),
  249
+ (4201, u'Zgornja Besnica'),
  250
+ (4202, u'Naklo'),
  251
+ (4203, u'Duplje'),
  252
+ (4204, u'Golnik'),
  253
+ (4205, u'Preddvor'),
  254
+ (4206, u'Zgornje Jezersko'),
  255
+ (4207, u'Cerklje na Gorenjskem'),
  256
+ (4208, u'\u0160en\u010dur'),
  257
+ (4209, u'\u017dabnica'),
  258
+ (4210, u'Brnik - aerodrom'),
  259
+ (4211, u'Mav\u010di\u010de'),
  260
+ (4212, u'Visoko'),
  261
+ (4220, u'\u0160kofja Loka'),
  262
+ (4223, u'Poljane nad \u0160kofjo Loko'),
  263
+ (4224, u'Gorenja vas'),
  264
+ (4225, u'Sovodenj'),
  265
+ (4226, u'\u017diri'),
  266
+ (4227, u'Selca'),
  267
+ (4228, u'\u017delezniki'),
  268
+ (4229, u'Sorica'),
  269
+ (4240, u'Radovljica'),
  270
+ (4243, u'Brezje'),
  271
+ (4244, u'Podnart'),
  272
+ (4245, u'Kropa'),
  273
+ (4246, u'Kamna Gorica'),
  274
+ (4247, u'Zgornje Gorje'),
  275
+ (4248, u'Lesce'),
  276
+ (4260, u'Bled'),
  277
+ (4263, u'Bohinjska Bela'),
  278
+ (4264, u'Bohinjska Bistrica'),
  279
+ (4265, u'Bohinjsko jezero'),
  280
+ (4267, u'Srednja vas v Bohinju'),
  281
+ (4270, u'Jesenice'),
  282
+ (4273, u'Blejska Dobrava'),
  283
+ (4274, u'\u017dirovnica'),
  284
+ (4275, u'Begunje na Gorenjskem'),
  285
+ (4276, u'Hru\u0161ica'),
  286
+ (4280, u'Kranjska Gora'),
  287
+ (4281, u'Mojstrana'),
  288
+ (4282, u'Gozd Martuljek'),
  289
+ (4283, u'Rate\u010de - Planica'),
  290
+ (4290, u'Tr\u017ei\u010d'),
  291
+ (4294, u'Kri\u017ee'),
  292
+ (5000, u'Nova Gorica'),
  293
+ (5210, u'Deskle'),
  294
+ (5211, u'Kojsko'),
  295
+ (5212, u'Dobrovo v Brdih'),
  296
+ (5213, u'Kanal'),
  297
+ (5214, u'Kal nad Kanalom'),
  298
+ (5215, u'Ro\u010dinj'),
  299
+ (5216, u'Most na So\u010di'),
  300
+ (5220, u'Tolmin'),
  301
+ (5222, u'Kobarid'),
  302
+ (5223, u'Breginj'),
  303
+ (5224, u'Srpenica'),
  304
+ (5230, u'Bovec'),
  305
+ (5231, u'Log pod Mangartom'),
  306
+ (5232, u'So\u010da'),
  307
+ (5242, u'Grahovo ob Ba\u010di'),
  308
+ (5243, u'Podbrdo'),
  309
+ (5250, u'Solkan'),
  310
+ (5251, u'Grgar'),
  311
+ (5252, u'Trnovo pri Gorici'),
  312
+ (5253, u'\u010cepovan'),
  313
+ (5261, u'\u0160empas'),
  314
+ (5262, u'\u010crni\u010de'),
  315
+ (5263, u'Dobravlje'),
  316
+ (5270, u'Ajdov\u0161\u010dina'),
  317
+ (5271, u'Vipava'),
  318
+ (5272, u'Podnanos'),
  319
+ (5273, u'Col'),
  320
+ (5274, u'\u010crni Vrh nad Idrijo'),
  321
+ (5275, u'Godovi\u010d'),
  322
+ (5280, u'Idrija'),
  323
+ (5281, u'Spodnja Idrija'),
  324
+ (5282, u'Cerkno'),
  325
+ (5283, u'Slap ob Idrijci'),
  326
+ (5290, u'\u0160empeter pri Gorici'),
  327
+ (5291, u'Miren'),
  328
+ (5292, u'Ren\u010de'),
  329
+ (5293, u'Vol\u010dja Draga'),
  330
+ (5294, u'Dornberk'),
  331
+ (5295, u'Branik'),
  332
+ (5296, u'Kostanjevica na Krasu'),
  333
+ (5297, u'Prva\u010dina'),
  334
+ (6000, u'Koper'),
  335
+ (6210, u'Se\u017eana'),
  336
+ (6215, u'Diva\u010da'),
  337
+ (6216, u'Podgorje'),
  338
+ (6217, u'Vremski Britof'),
  339
+ (6219, u'Lokev'),
  340
+ (6221, u'Dutovlje'),
  341
+ (6222, u'\u0160tanjel'),
  342
+ (6223, u'Komen'),
  343
+ (6224, u'Seno\u017ee\u010de'),
  344
+ (6225, u'Hru\u0161evje'),
  345
+ (6230, u'Postojna'),
  346
+ (6232, u'Planina'),
  347
+ (6240, u'Kozina'),
  348
+ (6242, u'Materija'),
  349
+ (6243, u'Obrov'),
  350
+ (6244, u'Podgrad'),
  351
+ (6250, u'Ilirska Bistrica'),
  352
+ (6251, u'Ilirska Bistrica - Trnovo'),
  353
+ (6253, u'Kne\u017eak'),
  354
+ (6254, u'Jel\u0161ane'),
  355
+ (6255, u'Prem'),
  356
+ (6256, u'Ko\u0161ana'),
  357
+ (6257, u'Pivka'),
  358
+ (6258, u'Prestranek'),
  359
+ (6271, u'Dekani'),
  360
+ (6272, u'Gra\u010di\u0161\u010de'),
  361
+ (6273, u'Marezige'),
  362
+ (6274, u'\u0160marje'),
  363
+ (6275, u'\u010crni Kal'),
  364
+ (6276, u'Pobegi'),
  365
+ (6280, u'Ankaran - Ancarano'),
  366
+ (6281, u'\u0160kofije'),
  367
+ (6310, u'Izola - Isola'),
  368
+ (6320, u'Portoro\u017e - Portorose'),
  369
+ (6330, u'Piran - Pirano'),
  370
+ (6333, u'Se\u010dovlje - Sicciole'),
  371
+ (8000, u'Novo mesto'),
  372
+ (8210, u'Trebnje'),
  373
+ (8211, u'Dobrni\u010d'),
  374
+ (8212, u'Velika Loka'),
  375
+ (8213, u'Veliki Gaber'),
  376
+ (8216, u'Mirna Pe\u010d'),
  377
+ (8220, u'\u0160marje\u0161ke Toplice'),
  378
+ (8222, u'Oto\u010dec'),
  379
+ (8230, u'Mokronog'),
  380
+ (8231, u'Trebelno'),
  381
+ (8232, u'\u0160entrupert'),
  382
+ (8233, u'Mirna'),
  383
+ (8250, u'Bre\u017eice'),
  384
+ (8251, u'\u010cate\u017e ob Savi'),
  385
+ (8253, u'Arti\u010de'),
  386
+ (8254, u'Globoko'),
  387
+ (8255, u'Pi\u0161ece'),
  388
+ (8256, u'Sromlje'),
  389
+ (8257, u'Dobova'),
  390
+ (8258, u'Kapele'),
  391
+ (8259, u'Bizeljsko'),
  392
+ (8261, u'Jesenice na Dolenjskem'),
  393
+ (8262, u'Kr\u0161ka vas'),
  394
+ (8263, u'Cerklje ob Krki'),
  395
+ (8270, u'Kr\u0161ko'),
  396
+ (8272, u'Zdole'),
  397
+ (8273, u'Leskovec pri Kr\u0161kem'),
  398
+ (8274, u'Raka'),
  399
+ (8275, u'\u0160kocjan'),
  400
+ (8276, u'Bu\u010dka'),
  401
+ (8280, u'Brestanica'),
  402
+ (8281, u'Senovo'),
  403
+ (8282, u'Koprivnica'),
  404
+ (8283, u'Blanca'),
  405
+ (8290, u'Sevnica'),
  406
+ (8292, u'Zabukovje'),
  407
+ (8293, u'Studenec'),
  408
+ (8294, u'Bo\u0161tanj'),
  409
+ (8295, u'Tr\u017ei\u0161\u010de'),
  410
+ (8296, u'Krmelj'),
  411
+ (8297, u'\u0160entjan\u017e'),
  412
+ (8310, u'\u0160entjernej'),
  413
+ (8311, u'Kostanjevica na Krki'),
  414
+ (8312, u'Podbo\u010dje'),
  415
+ (8321, u'Brusnice'),
  416
+ (8322, u'Stopi\u010de'),
  417
+ (8323, u'Ur\u0161na sela'),
  418
+ (8330, u'Metlika'),
  419
+ (8331, u'Suhor'),
  420
+ (8332, u'Gradac'),
  421
+ (8333, u'Semi\u010d'),
  422
+ (8340, u'\u010crnomelj'),
  423
+ (8341, u'Adle\u0161i\u010di'),
  424
+ (8342, u'Stari trg ob Kolpi'),
  425
+ (8343, u'Dragatu\u0161'),
  426
+ (8344, u'Vinica pri \u010crnomlju'),
  427
+ (8350, u'Dolenjske Toplice'),
  428
+ (8351, u'Stra\u017ea'),
  429
+ (8360, u'\u017du\u017eemberk'),
  430
+ (8361, u'Dvor'),
  431
+ (8362, u'Hinje'),
  432
+ (9000, u'Murska Sobota'),
  433
+ (9201, u'Puconci'),
  434
+ (9202, u'Ma\u010dkovci'),
  435
+ (9203, u'Petrovci'),
  436
+ (9204, u'\u0160alovci'),
  437
+ (9205, u'Hodo\u0161 - Hodos'),
  438
+ (9206, u'Kri\u017eevci'),
  439
+ (9207, u'Prosenjakovci - Partosfalva'),
  440
+ (9208, u'Fokovci'),
  441
+ (9220, u'Lendava - Lendva'),
  442
+ (9221, u'Martjanci'),
  443
+ (9222, u'Bogojina'),
  444
+ (9223, u'Dobrovnik - Dobronak'),
  445
+ (9224, u'Turni\u0161\u010de'),
  446
+ (9225, u'Velika Polana'),
  447
+ (9226, u'Moravske Toplice'),
  448
+ (9227, u'Kobilje'),
  449
+ (9231, u'Beltinci'),
  450
+ (9232, u'\u010cren\u0161ovci'),
  451
+ (9233, u'Odranci'),
  452
+ (9240, u'Ljutomer'),
  453
+ (9241, u'Ver\u017eej'),
  454
+ (9242, u'Kri\u017eevci pri Ljutomeru'),
  455
+ (9243, u'Mala Nedelja'),
  456
+ (9244, u'Sveti Jurij ob \u0160\u010davnici'),
  457
+ (9245, u'Spodnji Ivanjci'),
  458
+ (9250, u'Gornja Radgona'),
  459
+ (9251, u'Ti\u0161ina'),
  460
+ (9252, u'Radenci'),
  461
+ (9253, u'Apa\u010de'),
  462
+ (9261, u'Cankova'),
  463
+ (9262, u'Roga\u0161ovci'),
  464
+ (9263, u'Kuzma'),
  465
+ (9264, u'Grad'),
  466
+ (9265, u'Bodonci')]
  467
+
  468
+SI_POSTALCODES_CHOICES = sorted(SI_POSTALCODES, key=lambda k: k[1])
31  docs/ref/contrib/localflavor.txt
@@ -70,6 +70,7 @@ Countries currently supported by :mod:`~django.contrib.localflavor` are:
70 70
     * Romania_
71 71
     * Russia_
72 72
     * Slovakia_
  73
+    * Slovenia_
73 74
     * `South Africa`_
74 75
     * Spain_
75 76
     * Sweden_
@@ -126,6 +127,7 @@ Here's an example of how to use them::
126 127
 .. _Romania: `Romania (ro)`_
127 128
 .. _Russia: `Russia (ru)`_
128 129
 .. _Slovakia: `Slovakia (sk)`_
  130
+.. _Slovenia: `Slovenia (si)`_
129 131
 .. _South Africa: `South Africa (za)`_
130 132
 .. _Spain: `Spain (es)`_
131 133
 .. _Sweden: `Sweden (se)`_
@@ -1068,6 +1070,35 @@ Slovakia (``sk``)
1068 1070
 
1069 1071
     A ``Select`` widget that uses a list of Slovak regions as its choices.
1070 1072
 
  1073
+Slovenia (``si``)
  1074
+=================
  1075
+
  1076
+.. class:: si.forms.SIEMSOField
  1077
+
  1078
+    A form field that validates input as Slovenian personal identification
  1079
+    number and stores gender and birthday to self.info dictionary.
  1080
+
  1081
+.. class:: si.forms.SITaxNumberField
  1082
+
  1083
+    A form field that validates input as a Slovenian tax number. Valid input
  1084
+    is SIXXXXXXXX or XXXXXXXX.
  1085
+
  1086
+.. class:: si.forms.SIPhoneNumberField
  1087
+
  1088
+    A form field that validates input as a Slovenian phone number. Phone
  1089
+    number must contain at least local area code with optional country code.
  1090
+
  1091
+.. class:: si.forms.SIPostalCodeField
  1092
+
  1093
+    A form field that provides a choice field of major Slovenian postal
  1094
+    codes.
  1095
+
  1096
+.. class:: si.forms.SIPostalCodeSelect
  1097
+
  1098
+    A ``Select`` widget that uses a list of major Slovenian postal codes as
  1099
+    its choices.
  1100
+
  1101
+
1071 1102
 South Africa (``za``)
1072 1103
 =====================
1073 1104
 
0  localflavor/si/__init__.py b/django/contrib/localflavor/si/__init__.py
No changes.
0  tests/regressiontests/localflavor/si/__init__.py
No changes.
556  tests/regressiontests/localflavor/si/tests.py
... ...
@@ -0,0 +1,556 @@
  1
+# -*- coding: utf-8 -*-
  2
+
  3
+from datetime import date
  4
+
  5
+from django.contrib.localflavor.si.forms import (SIEMSOField, SITaxNumberField,
  6
+    SIPhoneNumberField, SIPostalCodeField, SIPostalCodeSelect)
  7
+from django.test import SimpleTestCase
  8
+
  9
+
  10
+class SILocalFlavorTests(SimpleTestCase):
  11
+    def test_SITaxNumberField(self):
  12
+        error_invalid = [u'Enter a valid tax number in form SIXXXXXXXX']
  13
+        valid = {
  14
+            '15012557': '15012557',
  15
+            'SI15012557': '15012557',
  16
+            '22111310': '22111310',
  17
+        }
  18
+        invalid = {
  19
+            '22241310': error_invalid,
  20
+            '15012558': error_invalid,
  21
+            '1501': error_invalid,
  22
+            '1501123123123': error_invalid,
  23
+            'abcdabcd': error_invalid,
  24
+            '01234579': error_invalid,
  25
+        }
  26
+        self.assertFieldOutput(SITaxNumberField, valid, invalid)
  27
+
  28
+    def test_SIEMSOField(self):
  29
+        error_invalid = [u'This field should contain exactly 13 digits.']
  30
+        error_invalid_date = [u'The first 7 digits of the EMSO must represent a valid past date.']
  31
+        error_invalid_chksum = [u'The EMSO is not valid.']
  32
+        valid = {
  33
+            '0205951500462': '0205951500462',
  34
+            '2309002500068': '2309002500068',
  35
+            '1010985500400': '1010985500400',
  36
+        }
  37
+        invalid = {
  38
+            '0205951500463': error_invalid_chksum,
  39
+            '020': error_invalid,
  40
+            '020020595150046020595150046': error_invalid,
  41
+            'aaaabbbbccccd': error_invalid,
  42
+            '1010985500800': error_invalid_chksum,
  43
+            '2020095500070': error_invalid_date,
  44
+            '5050095500078': error_invalid_date,
  45
+            '1010889500408': error_invalid_date,
  46
+        }
  47
+        self.assertFieldOutput(SIEMSOField, valid, invalid)
  48
+
  49
+    def test_SIEMSOField_info_dict(self):
  50
+        valid = {
  51
+            '0205951500462': {'nationality': 50, 'gender': 'male', 'birthdate': date(1951, 5, 2)},
  52
+            '2309002504063': {'nationality': 50, 'gender': 'male', 'birthdate': date(2002, 9, 23)},
  53
+            '1010985505402': {'nationality': 50, 'gender': 'female', 'birthdate': date(1985, 10, 10)},
  54
+        }
  55
+        for input, info in valid.items():
  56
+            f = SIEMSOField()
  57
+            f.clean(input)
  58
+            self.assertEqual(f.info, info)
  59
+
  60
+    def test_SIPhoneNumberField(self):
  61
+        error_invalid = [u'Enter phone number in form +386XXXXXXXX or 0XXXXXXXX.']
  62
+        valid = {
  63
+            '+38640999999': '40999999',
  64
+            '+3861999999': '1999999',
  65
+            '0038640999999': '40999999',
  66
+            '040999999': '40999999',
  67
+            '01999999': '1999999',
  68
+            '059099999': '59099999',
  69
+            '059 09 99 99': '59099999',
  70
+            '0590/999-99': '59099999',
  71
+        }
  72
+        invalid = {
  73
+            '03861999999': error_invalid,
  74
+            '3861999999': error_invalid,
  75
+        }
  76
+        self.assertFieldOutput(SIPhoneNumberField, valid, invalid)
  77
+
  78
+    def test_SIPostalCodeField(self):
  79
+        valid = {
  80
+            '4000': '4000',
  81
+            '1000': '1000'
  82
+        }
  83
+        invalid = {
  84
+            '1113': [u'Select a valid choice. 1113 is not one of the available choices.'],
  85
+            '111': [u'Select a valid choice. 111 is not one of the available choices.'],
  86
+        }
  87
+        self.assertFieldOutput(SIPostalCodeField, valid, invalid)
  88
+
  89
+    def test_SIPostalCodeSelect(self):
  90
+        f = SIPostalCodeSelect()
  91
+        out = u'''<select name="Kranj">
  92
+<option value="8341">Adle\u0161i\u010di</option>
  93
+<option value="5270">Ajdov\u0161\u010dina</option>
  94
+<option value="6280">Ankaran - Ancarano</option>
  95
+<option value="9253">Apa\u010de</option>
  96
+<option value="8253">Arti\u010de</option>
  97
+<option value="4275">Begunje na Gorenjskem</option>
  98
+<option value="1382">Begunje pri Cerknici</option>
  99
+<option value="9231">Beltinci</option>
  100
+<option value="2234">Benedikt</option>
  101
+<option value="2345">Bistrica ob Dravi</option>
  102
+<option value="3256">Bistrica ob Sotli</option>
  103
+<option value="8259">Bizeljsko</option>
  104
+<option value="1223">Blagovica</option>
  105
+<option value="8283">Blanca</option>
  106
+<option value="4260">Bled</option>
  107
+<option value="4273">Blejska Dobrava</option>
  108
+<option value="9265">Bodonci</option>
  109
+<option value="9222">Bogojina</option>
  110
+<option value="4263">Bohinjska Bela</option>
  111
+<option value="4264">Bohinjska Bistrica</option>
  112
+<option value="4265">Bohinjsko jezero</option>
  113
+<option value="1353">Borovnica</option>
  114
+<option value="5230">Bovec</option>
  115
+<option value="8294">Bo\u0161tanj</option>
  116
+<option value="5295">Branik</option>
  117
+<option value="3314">Braslov\u010de</option>
  118
+<option value="5223">Breginj</option>
  119
+<option value="8280">Brestanica</option>
  120
+<option value="2354">Bresternica</option>
  121
+<option value="4243">Brezje</option>
  122
+<option value="1351">Brezovica pri Ljubljani</option>
  123
+<option value="8250">Bre\u017eice</option>
  124
+<option value="4210">Brnik - aerodrom</option>
  125
+<option value="8321">Brusnice</option>
  126
+<option value="3255">Bu\u010de</option>
  127
+<option value="8276">Bu\u010dka</option>
  128
+<option value="9261">Cankova</option>
  129
+<option value="3000">Celje</option>
  130
+<option value="4207">Cerklje na Gorenjskem</option>
  131
+<option value="8263">Cerklje ob Krki</option>
  132
+<option value="1380">Cerknica</option>
  133
+<option value="5282">Cerkno</option>
  134
+<option value="2236">Cerkvenjak</option>
  135
+<option value="2215">Cer\u0161ak</option>
  136
+<option value="2326">Cirkovce</option>
  137
+<option value="2282">Cirkulane</option>
  138
+<option value="5273">Col</option>
  139
+<option value="6271">Dekani</option>
  140
+<option value="5210">Deskle</option>
  141
+<option value="2253">Destrnik</option>
  142
+<option value="6215">Diva\u010da</option>
  143
+<option value="1233">Dob</option>
  144
+<option value="3224">Dobje pri Planini</option>
  145
+<option value="8257">Dobova</option>
  146
+<option value="1423">Dobovec</option>
  147
+<option value="5263">Dobravlje</option>
  148
+<option value="3204">Dobrna</option>
  149
+<option value="8211">Dobrni\u010d</option>
  150
+<option value="1356">Dobrova</option>
  151
+<option value="9223">Dobrovnik - Dobronak</option>
  152
+<option value="5212">Dobrovo v Brdih</option>
  153
+<option value="1431">Dol pri Hrastniku</option>
  154
+<option value="1262">Dol pri Ljubljani</option>
  155
+<option value="1273">Dole pri Litiji</option>
  156
+<option value="1331">Dolenja vas</option>
  157
+<option value="8350">Dolenjske Toplice</option>
  158
+<option value="1230">Dom\u017eale</option>
  159
+<option value="2252">Dornava</option>
  160
+<option value="5294">Dornberk</option>
  161
+<option value="1319">Draga</option>
  162
+<option value="8343">Dragatu\u0161</option>
  163
+<option value="3222">Dramlje</option>
  164
+<option value="2370">Dravograd</option>
  165
+<option value="4203">Duplje</option>
  166
+<option value="6221">Dutovlje</option>
  167
+<option value="8361">Dvor</option>
  168
+<option value="2343">Fala</option>
  169
+<option value="9208">Fokovci</option>
  170
+<option value="2313">Fram</option>
  171
+<option value="3213">Frankolovo</option>
  172
+<option value="1274">Gabrovka</option>
  173
+<option value="8254">Globoko</option>
  174
+<option value="5275">Godovi\u010d</option>
  175
+<option value="4204">Golnik</option>
  176
+<option value="3303">Gomilsko</option>
  177
+<option value="4224">Gorenja vas</option>
  178
+<option value="3263">Gorica pri Slivnici</option>
  179
+<option value="2272">Gori\u0161nica</option>
  180
+<option value="9250">Gornja Radgona</option>
  181
+<option value="3342">Gornji Grad</option>
  182
+<option value="4282">Gozd Martuljek</option>
  183
+<option value="9264">Grad</option>
  184
+<option value="8332">Gradac</option>
  185
+<option value="1384">Grahovo</option>
  186
+<option value="5242">Grahovo ob Ba\u010di</option>
  187
+<option value="6272">Gra\u010di\u0161\u010de</option>
  188
+<option value="5251">Grgar</option>
  189
+<option value="3302">Gri\u017ee</option>
  190
+<option value="3231">Grobelno</option>
  191
+<option value="1290">Grosuplje</option>
  192
+<option value="2288">Hajdina</option>
  193
+<option value="8362">Hinje</option>
  194
+<option value="9205">Hodo\u0161 - Hodos</option>
  195
+<option value="1354">Horjul</option>
  196
+<option value="1372">Hotedr\u0161ica</option>
  197
+<option value="2311">Ho\u010de</option>
  198
+<option value="1430">Hrastnik</option>
  199
+<option value="6225">Hru\u0161evje</option>
  200
+<option value="4276">Hru\u0161ica</option>
  201
+<option value="5280">Idrija</option>
  202
+<option value="1292">Ig</option>
  203
+<option value="6250">Ilirska Bistrica</option>
  204
+<option value="6251">Ilirska Bistrica - Trnovo</option>
  205
+<option value="2259">Ivanjkovci</option>
  206
+<option value="1295">Ivan\u010dna Gorica</option>
  207
+<option value="1411">Izlake</option>
  208
+<option value="6310">Izola - Isola</option>
  209
+<option value="2222">Jakobski Dol</option>
  210
+<option value="2221">Jarenina</option>
  211
+<option value="6254">Jel\u0161ane</option>
  212
+<option value="4270">Jesenice</option>
  213
+<option value="8261">Jesenice na Dolenjskem</option>
  214
+<option value="3273">Jurklo\u0161ter</option>
  215
+<option value="2223">Jurovski Dol</option>
  216
+<option value="2256">Jur\u0161inci</option>
  217
+<option value="5214">Kal nad Kanalom</option>
  218
+<option value="3233">Kalobje</option>
  219
+<option value="4246">Kamna Gorica</option>
  220
+<option value="2351">Kamnica</option>
  221
+<option value="1241">Kamnik</option>
  222
+<option value="5213">Kanal</option>
  223
+<option value="8258">Kapele</option>
  224
+<option value="2362">Kapla</option>
  225
+<option value="2325">Kidri\u010devo</option>
  226
+<option value="1412">Kisovec</option>
  227
+<option value="6253">Kne\u017eak</option>
  228
+<option value="5222">Kobarid</option>
  229
+<option value="9227">Kobilje</option>
  230
+<option value="2276">Kog</option>
  231
+<option value="5211">Kojsko</option>
  232
+<option value="6223">Komen</option>
  233
+<option value="1218">Komenda</option>
  234
+<option value="6000">Koper</option>
  235
+<option value="8282">Koprivnica</option>
  236
+<option value="5296">Kostanjevica na Krasu</option>
  237
+<option value="8311">Kostanjevica na Krki</option>
  238
+<option value="1336">Kostel</option>
  239
+<option value="2394">Kotlje</option>
  240
+<option value="6240">Kozina</option>
  241
+<option value="3260">Kozje</option>
  242
+<option value="1330">Ko\u010devje</option>
  243
+<option value="1338">Ko\u010devska Reka</option>
  244
+<option value="6256">Ko\u0161ana</option>
  245
+<option value="4000" selected="selected">Kranj</option>
  246
+<option value="4280">Kranjska Gora</option>
  247
+<option value="1281">Kresnice</option>
  248
+<option value="4294">Kri\u017ee</option>
  249
+<option value="9206">Kri\u017eevci</option>
  250
+<option value="9242">Kri\u017eevci pri Ljutomeru</option>
  251
+<option value="1301">Krka</option>
  252
+<option value="8296">Krmelj</option>
  253
+<option value="4245">Kropa</option>
  254
+<option value="8262">Kr\u0161ka vas</option>
  255
+<option value="8270">Kr\u0161ko</option>
  256
+<option value="9263">Kuzma</option>
  257
+<option value="2318">Laporje</option>
  258
+<option value="1219">Laze v Tuhinju</option>
  259
+<option value="3270">La\u0161ko</option>
  260
+<option value="2230">Lenart v Slovenskih goricah</option>
  261
+<option value="9220">Lendava - Lendva</option>
  262
+<option value="4248">Lesce</option>
  263
+<option value="3261">Lesi\u010dno</option>
  264
+<option value="8273">Leskovec pri Kr\u0161kem</option>
  265
+<option value="2372">Libeli\u010de</option>
  266
+<option value="2341">Limbu\u0161</option>
  267
+<option value="1270">Litija</option>
  268
+<option value="3202">Ljube\u010dna</option>
  269
+<option value="1000">Ljubljana</option>
  270
+<option value="3333">Ljubno ob Savinji</option>
  271
+<option value="9240">Ljutomer</option>
  272
+<option value="5231">Log pod Mangartom</option>
  273
+<option value="1358">Log pri Brezovici</option>
  274
+<option value="1370">Logatec</option>
  275
+<option value="1434">Loka pri Zidanem Mostu</option>
  276
+<option value="3223">Loka pri \u017dusmu</option>
  277
+<option value="6219">Lokev</option>
  278
+<option value="2324">Lovrenc na Dravskem polju</option>
  279
+<option value="2344">Lovrenc na Pohorju</option>
  280
+<option value="3215">Lo\u010de</option>
  281
+<option value="1318">Lo\u0161ki Potok</option>
  282
+<option value="1225">Lukovica</option>
  283
+<option value="3334">Lu\u010de</option>
  284
+<option value="2322">Maj\u0161perk</option>
  285
+<option value="2321">Makole</option>
  286
+<option value="9243">Mala Nedelja</option>
  287
+<option value="2229">Male\u010dnik</option>
  288
+<option value="6273">Marezige</option>
  289
+<option value="2000">Maribor</option>
  290
+<option value="2206">Marjeta na Dravskem polju</option>
  291
+<option value="2281">Markovci</option>
  292
+<option value="9221">Martjanci</option>
  293
+<option value="6242">Materija</option>
  294
+<option value="4211">Mav\u010di\u010de</option>
  295
+<option value="9202">Ma\u010dkovci</option>
  296
+<option value="1215">Medvode</option>
  297
+<option value="1234">Menge\u0161</option>
  298
+<option value="8330">Metlika</option>
  299
+<option value="2392">Me\u017eica</option>
  300
+<option value="2204">Miklav\u017e na Dravskem polju</option>
  301
+<option value="2275">Miklav\u017e pri Ormo\u017eu</option>
  302
+<option value="5291">Miren</option>
  303
+<option value="8233">Mirna</option>
  304
+<option value="8216">Mirna Pe\u010d</option>
  305
+<option value="2382">Mislinja</option>
  306
+<option value="4281">Mojstrana</option>
  307
+<option value="8230">Mokronog</option>
  308
+<option value="9226">Moravske Toplice</option>
  309
+<option value="1251">Morav\u010de</option>
  310
+<option value="5216">Most na So\u010di</option>
  311
+<option value="1221">Motnik</option>
  312
+<option value="3330">Mozirje</option>
  313
+<option value="9000">Murska Sobota</option>
  314
+<option value="2366">Muta</option>
  315
+<option value="4202">Naklo</option>
  316
+<option value="3331">Nazarje</option>
  317
+<option value="1357">Notranje Gorice</option>
  318
+<option value="3203">Nova Cerkev</option>
  319
+<option value="5000">Nova Gorica</option>
  320
+<option value="1385">Nova vas</option>
  321
+<option value="8000">Novo mesto</option>
  322
+<option value="6243">Obrov</option>
  323
+<option value="9233">Odranci</option>
  324
+<option value="2317">Oplotnica</option>
  325
+<option value="2312">Orehova vas</option>
  326
+<option value="2270">Ormo\u017e</option>
  327
+<option value="1316">Ortnek</option>
  328
+<option value="1337">Osilnica</option>
  329
+<option value="8222">Oto\u010dec</option>
  330
+<option value="2361">O\u017ebalt</option>
  331
+<option value="2231">Pernica</option>
  332
+<option value="2211">Pesnica pri Mariboru</option>
  333
+<option value="9203">Petrovci</option>
  334
+<option value="3301">Petrov\u010de</option>
  335
+<option value="6330">Piran - Pirano</option>
  336
+<option value="6257">Pivka</option>
  337
+<option value="8255">Pi\u0161ece</option>
  338
+<option value="6232">Planina</option>
  339
+<option value="3225">Planina pri Sevnici</option>
  340
+<option value="6276">Pobegi</option>
  341
+<option value="8312">Podbo\u010dje</option>
  342
+<option value="5243">Podbrdo</option>
  343
+<option value="2273">Podgorci</option>
  344
+<option value="6216">Podgorje</option>
  345
+<option value="2381">Podgorje pri Slovenj Gradcu</option>
  346
+<option value="6244">Podgrad</option>
  347
+<option value="1414">Podkum</option>
  348
+<option value="2286">Podlehnik</option>
  349
+<option value="5272">Podnanos</option>
  350
+<option value="4244">Podnart</option>
  351
+<option value="3241">Podplat</option>
  352
+<option value="3257">Podsreda</option>
  353
+<option value="2363">Podvelka</option>
  354
+<option value="3254">Pod\u010detrtek</option>
  355
+<option value="2208">Pohorje</option>
  356
+<option value="2257">Polen\u0161ak</option>
  357
+<option value="1355">Polhov Gradec</option>
  358
+<option value="4223">Poljane nad \u0160kofjo Loko</option>
  359
+<option value="2319">Polj\u010dane</option>
  360
+<option value="3313">Polzela</option>
  361
+<option value="1272">Pol\u0161nik</option>
  362
+<option value="3232">Ponikva</option>
  363
+<option value="6320">Portoro\u017e - Portorose</option>
  364
+<option value="6230">Postojna</option>
  365
+<option value="2331">Pragersko</option>
  366
+<option value="3312">Prebold</option>
  367
+<option value="4205">Preddvor</option>
  368
+<option value="6255">Prem</option>
  369
+<option value="1352">Preserje</option>
  370
+<option value="6258">Prestranek</option>
  371
+<option value="2391">Prevalje</option>
  372
+<option value="3262">Prevorje</option>
  373
+<option value="1276">Primskovo</option>
  374
+<option value="3253">Pristava pri Mestinju</option>
  375
+<option value="9207">Prosenjakovci - Partosfalva</option>
  376
+<option value="5297">Prva\u010dina</option>
  377
+<option value="2250">Ptuj</option>
  378
+<option value="2323">Ptujska Gora</option>
  379
+<option value="9201">Puconci</option>
  380
+<option value="9252">Radenci</option>
  381
+<option value="1433">Rade\u010de</option>
  382
+<option value="2360">Radlje ob Dravi</option>
  383
+<option value="1235">Radomlje</option>
  384
+<option value="4240">Radovljica</option>
  385
+<option value="8274">Raka</option>
  386
+<option value="1381">Rakek</option>
  387
+<option value="4283">Rate\u010de - Planica</option>
  388
+<option value="2390">Ravne na Koro\u0161kem</option>
  389
+<option value="2327">Ra\u010de</option>
  390
+<option value="5292">Ren\u010de</option>
  391
+<option value="3332">Re\u010dica ob Savinji</option>
  392
+<option value="1310">Ribnica</option>
  393
+<option value="2364">Ribnica na Pohorju</option>
  394
+<option value="3272">Rimske Toplice</option>
  395
+<option value="1314">Rob</option>
  396
+<option value="3252">Rogatec</option>
  397
+<option value="3250">Roga\u0161ka Slatina</option>
  398
+<option value="9262">Roga\u0161ovci</option>
  399
+<option value="1373">Rovte</option>
  400
+<option value="5215">Ro\u010dinj</option>
  401
+<option value="2342">Ru\u0161e</option>
  402
+<option value="1282">Sava</option>