summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2014-12-30 16:58:28 +0100
committerÉtienne Loks <etienne.loks@proxience.com>2015-05-06 15:38:32 +0200
commit155b3890c7938e98f6c1596551260a92041bea68 (patch)
treee9f76228e561db13b5d76df05cb590e6f8e85912
parent9807ea236f07a2caf806e6c02ce0fa78e006ea92 (diff)
downloadIshtar-155b3890c7938e98f6c1596551260a92041bea68.tar.bz2
Ishtar-155b3890c7938e98f6c1596551260a92041bea68.zip
Add new fields for towns - update default department and states for France
-rw-r--r--ishtar_common/fixtures/initial_dpts-fr.json1127
-rw-r--r--ishtar_common/management/commands/update_towns.py22
-rw-r--r--ishtar_common/migrations/0017_auto__add_state__add_field_department_state.py243
-rw-r--r--ishtar_common/models.py15
4 files changed, 1406 insertions, 1 deletions
diff --git a/ishtar_common/fixtures/initial_dpts-fr.json b/ishtar_common/fixtures/initial_dpts-fr.json
new file mode 100644
index 000000000..721a96a8a
--- /dev/null
+++ b/ishtar_common/fixtures/initial_dpts-fr.json
@@ -0,0 +1,1127 @@
+[
+ {
+ "pk": 28,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "1",
+ "label": "Guadeloupe"
+ }
+ },
+ {
+ "pk": 33,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "11",
+ "label": "\u00cele-de-France"
+ }
+ },
+ {
+ "pk": 29,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "2",
+ "label": "Martinique"
+ }
+ },
+ {
+ "pk": 34,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "21",
+ "label": "Champagne-Ardenne"
+ }
+ },
+ {
+ "pk": 35,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "22",
+ "label": "Picardie"
+ }
+ },
+ {
+ "pk": 36,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "23",
+ "label": "Haute-Normandie"
+ }
+ },
+ {
+ "pk": 37,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "24",
+ "label": "Centre"
+ }
+ },
+ {
+ "pk": 38,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "25",
+ "label": "Basse-Normandie"
+ }
+ },
+ {
+ "pk": 39,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "26",
+ "label": "Bourgogne"
+ }
+ },
+ {
+ "pk": 30,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "3",
+ "label": "Guyane"
+ }
+ },
+ {
+ "pk": 40,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "31",
+ "label": "Nord-Pas-de-Calais"
+ }
+ },
+ {
+ "pk": 31,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "4",
+ "label": "La R\u00e9union"
+ }
+ },
+ {
+ "pk": 41,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "41",
+ "label": "Lorraine"
+ }
+ },
+ {
+ "pk": 42,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "42",
+ "label": "Alsace"
+ }
+ },
+ {
+ "pk": 43,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "43",
+ "label": "Franche-Comt\u00e9"
+ }
+ },
+ {
+ "pk": 44,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "52",
+ "label": "Pays de la Loire"
+ }
+ },
+ {
+ "pk": 45,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "53",
+ "label": "Bretagne"
+ }
+ },
+ {
+ "pk": 46,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "54",
+ "label": "Poitou-Charentes"
+ }
+ },
+ {
+ "pk": 32,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "6",
+ "label": "Mayotte"
+ }
+ },
+ {
+ "pk": 47,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "72",
+ "label": "Aquitaine"
+ }
+ },
+ {
+ "pk": 48,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "73",
+ "label": "Midi-Pyr\u00e9n\u00e9es"
+ }
+ },
+ {
+ "pk": 49,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "74",
+ "label": "Limousin"
+ }
+ },
+ {
+ "pk": 50,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "82",
+ "label": "Rh\u00f4ne-Alpes"
+ }
+ },
+ {
+ "pk": 51,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "83",
+ "label": "Auvergne"
+ }
+ },
+ {
+ "pk": 52,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "91",
+ "label": "Languedoc-Roussillon"
+ }
+ },
+ {
+ "pk": 53,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "93",
+ "label": "Provence-Alpes-C\u00f4te d'Azur"
+ }
+ },
+ {
+ "pk": 54,
+ "model": "ishtar_common.state",
+ "fields": {
+ "number": "94",
+ "label": "Corse"
+ }
+ },
+ {
+ "pk": 1,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 50,
+ "number": "01",
+ "label": "Ain"
+ }
+ },
+ {
+ "pk": 2,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 35,
+ "number": "02",
+ "label": "Aisne"
+ }
+ },
+ {
+ "pk": 3,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 51,
+ "number": "03",
+ "label": "Allier"
+ }
+ },
+ {
+ "pk": 4,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 53,
+ "number": "04",
+ "label": "Alpes-de-Haute-Provence"
+ }
+ },
+ {
+ "pk": 5,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 53,
+ "number": "05",
+ "label": "Hautes-Alpes"
+ }
+ },
+ {
+ "pk": 6,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 53,
+ "number": "06",
+ "label": "Alpes-Maritimes"
+ }
+ },
+ {
+ "pk": 7,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 50,
+ "number": "07",
+ "label": "Ard\u00e8che"
+ }
+ },
+ {
+ "pk": 8,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 34,
+ "number": "08",
+ "label": "Ardennes"
+ }
+ },
+ {
+ "pk": 9,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 48,
+ "number": "09",
+ "label": "Ari\u00e8ge"
+ }
+ },
+ {
+ "pk": 10,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 34,
+ "number": "10",
+ "label": "Aube"
+ }
+ },
+ {
+ "pk": 11,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 52,
+ "number": "11",
+ "label": "Aude"
+ }
+ },
+ {
+ "pk": 12,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 48,
+ "number": "12",
+ "label": "Aveyron"
+ }
+ },
+ {
+ "pk": 13,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 53,
+ "number": "13",
+ "label": "Bouches-du-Rh\u00f4ne"
+ }
+ },
+ {
+ "pk": 14,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 38,
+ "number": "14",
+ "label": "Calvados"
+ }
+ },
+ {
+ "pk": 15,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 51,
+ "number": "15",
+ "label": "Cantal"
+ }
+ },
+ {
+ "pk": 16,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 46,
+ "number": "16",
+ "label": "Charente"
+ }
+ },
+ {
+ "pk": 17,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 46,
+ "number": "17",
+ "label": "Charente-Maritime"
+ }
+ },
+ {
+ "pk": 18,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 37,
+ "number": "18",
+ "label": "Cher"
+ }
+ },
+ {
+ "pk": 19,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 49,
+ "number": "19",
+ "label": "Corr\u00e8ze"
+ }
+ },
+ {
+ "pk": 22,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 39,
+ "number": "21",
+ "label": "C\u00f4te-d'Or"
+ }
+ },
+ {
+ "pk": 23,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 45,
+ "number": "22",
+ "label": "C\u00f4tes-d'Armor"
+ }
+ },
+ {
+ "pk": 24,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 49,
+ "number": "23",
+ "label": "Creuse"
+ }
+ },
+ {
+ "pk": 25,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 47,
+ "number": "24",
+ "label": "Dordogne"
+ }
+ },
+ {
+ "pk": 26,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 43,
+ "number": "25",
+ "label": "Doubs"
+ }
+ },
+ {
+ "pk": 27,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 50,
+ "number": "26",
+ "label": "Dr\u00f4me"
+ }
+ },
+ {
+ "pk": 28,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 36,
+ "number": "27",
+ "label": "Eure"
+ }
+ },
+ {
+ "pk": 29,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 37,
+ "number": "28",
+ "label": "Eure-et-Loir"
+ }
+ },
+ {
+ "pk": 30,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 45,
+ "number": "29",
+ "label": "Finist\u00e8re"
+ }
+ },
+ {
+ "pk": 20,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 54,
+ "number": "2A",
+ "label": "Corse-du-Sud"
+ }
+ },
+ {
+ "pk": 21,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 54,
+ "number": "2B",
+ "label": "Haute-Corse"
+ }
+ },
+ {
+ "pk": 31,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 52,
+ "number": "30",
+ "label": "Gard"
+ }
+ },
+ {
+ "pk": 32,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 48,
+ "number": "31",
+ "label": "Haute-Garonne"
+ }
+ },
+ {
+ "pk": 33,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 48,
+ "number": "32",
+ "label": "Gers"
+ }
+ },
+ {
+ "pk": 34,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 47,
+ "number": "33",
+ "label": "Gironde"
+ }
+ },
+ {
+ "pk": 35,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 52,
+ "number": "34",
+ "label": "H\u00e9rault"
+ }
+ },
+ {
+ "pk": 36,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 45,
+ "number": "35",
+ "label": "Ille-et-Vilaine"
+ }
+ },
+ {
+ "pk": 37,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 37,
+ "number": "36",
+ "label": "Indre"
+ }
+ },
+ {
+ "pk": 38,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 37,
+ "number": "37",
+ "label": "Indre-et-Loire"
+ }
+ },
+ {
+ "pk": 39,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 50,
+ "number": "38",
+ "label": "Is\u00e8re"
+ }
+ },
+ {
+ "pk": 40,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 43,
+ "number": "39",
+ "label": "Jura"
+ }
+ },
+ {
+ "pk": 41,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 47,
+ "number": "40",
+ "label": "Landes"
+ }
+ },
+ {
+ "pk": 42,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 37,
+ "number": "41",
+ "label": "Loir-et-Cher"
+ }
+ },
+ {
+ "pk": 43,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 50,
+ "number": "42",
+ "label": "Loire"
+ }
+ },
+ {
+ "pk": 44,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 51,
+ "number": "43",
+ "label": "Haute-Loire"
+ }
+ },
+ {
+ "pk": 45,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 44,
+ "number": "44",
+ "label": "Loire-Atlantique"
+ }
+ },
+ {
+ "pk": 46,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 37,
+ "number": "45",
+ "label": "Loiret"
+ }
+ },
+ {
+ "pk": 47,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 48,
+ "number": "46",
+ "label": "Lot"
+ }
+ },
+ {
+ "pk": 48,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 47,
+ "number": "47",
+ "label": "Lot-et-Garonne"
+ }
+ },
+ {
+ "pk": 49,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 52,
+ "number": "48",
+ "label": "Loz\u00e8re"
+ }
+ },
+ {
+ "pk": 50,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 44,
+ "number": "49",
+ "label": "Maine-et-Loire"
+ }
+ },
+ {
+ "pk": 51,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 38,
+ "number": "50",
+ "label": "Manche"
+ }
+ },
+ {
+ "pk": 52,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 34,
+ "number": "51",
+ "label": "Marne"
+ }
+ },
+ {
+ "pk": 53,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 34,
+ "number": "52",
+ "label": "Haute-Marne"
+ }
+ },
+ {
+ "pk": 54,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 44,
+ "number": "53",
+ "label": "Mayenne"
+ }
+ },
+ {
+ "pk": 55,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 41,
+ "number": "54",
+ "label": "Meurthe-et-Moselle"
+ }
+ },
+ {
+ "pk": 56,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 41,
+ "number": "55",
+ "label": "Meuse"
+ }
+ },
+ {
+ "pk": 57,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 45,
+ "number": "56",
+ "label": "Morbihan"
+ }
+ },
+ {
+ "pk": 58,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 41,
+ "number": "57",
+ "label": "Moselle"
+ }
+ },
+ {
+ "pk": 59,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 39,
+ "number": "58",
+ "label": "Ni\u00e8vre"
+ }
+ },
+ {
+ "pk": 60,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 40,
+ "number": "59",
+ "label": "Nord"
+ }
+ },
+ {
+ "pk": 61,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 35,
+ "number": "60",
+ "label": "Oise"
+ }
+ },
+ {
+ "pk": 62,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 38,
+ "number": "61",
+ "label": "Orne"
+ }
+ },
+ {
+ "pk": 63,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 40,
+ "number": "62",
+ "label": "Pas-de-Calais"
+ }
+ },
+ {
+ "pk": 64,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 51,
+ "number": "63",
+ "label": "Puy-de-D\u00f4me"
+ }
+ },
+ {
+ "pk": 65,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 47,
+ "number": "64",
+ "label": "Pyr\u00e9n\u00e9es-Atlantiques"
+ }
+ },
+ {
+ "pk": 66,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 48,
+ "number": "65",
+ "label": "Hautes-Pyr\u00e9n\u00e9es"
+ }
+ },
+ {
+ "pk": 67,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 52,
+ "number": "66",
+ "label": "Pyr\u00e9n\u00e9es-Orientales"
+ }
+ },
+ {
+ "pk": 68,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 42,
+ "number": "67",
+ "label": "Bas-Rhin"
+ }
+ },
+ {
+ "pk": 69,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 42,
+ "number": "68",
+ "label": "Haut-Rhin"
+ }
+ },
+ {
+ "pk": 70,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 50,
+ "number": "69",
+ "label": "Rh\u00f4ne"
+ }
+ },
+ {
+ "pk": 71,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 43,
+ "number": "70",
+ "label": "Haute-Sa\u00f4ne"
+ }
+ },
+ {
+ "pk": 72,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 39,
+ "number": "71",
+ "label": "Sa\u00f4ne-et-Loire"
+ }
+ },
+ {
+ "pk": 73,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 44,
+ "number": "72",
+ "label": "Sarthe"
+ }
+ },
+ {
+ "pk": 74,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 50,
+ "number": "73",
+ "label": "Savoie"
+ }
+ },
+ {
+ "pk": 75,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 50,
+ "number": "74",
+ "label": "Haute-Savoie"
+ }
+ },
+ {
+ "pk": 76,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 33,
+ "number": "75",
+ "label": "Paris"
+ }
+ },
+ {
+ "pk": 77,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 36,
+ "number": "76",
+ "label": "Seine-Maritime"
+ }
+ },
+ {
+ "pk": 78,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 33,
+ "number": "77",
+ "label": "Seine-et-Marne"
+ }
+ },
+ {
+ "pk": 79,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 33,
+ "number": "78",
+ "label": "Yvelines"
+ }
+ },
+ {
+ "pk": 80,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 46,
+ "number": "79",
+ "label": "Deux-S\u00e8vres"
+ }
+ },
+ {
+ "pk": 81,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 35,
+ "number": "80",
+ "label": "Somme"
+ }
+ },
+ {
+ "pk": 82,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 48,
+ "number": "81",
+ "label": "Tarn"
+ }
+ },
+ {
+ "pk": 83,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 48,
+ "number": "82",
+ "label": "Tarn-et-Garonne"
+ }
+ },
+ {
+ "pk": 84,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 53,
+ "number": "83",
+ "label": "Var"
+ }
+ },
+ {
+ "pk": 85,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 53,
+ "number": "84",
+ "label": "Vaucluse"
+ }
+ },
+ {
+ "pk": 86,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 44,
+ "number": "85",
+ "label": "Vend\u00e9e"
+ }
+ },
+ {
+ "pk": 87,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 46,
+ "number": "86",
+ "label": "Vienne"
+ }
+ },
+ {
+ "pk": 88,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 49,
+ "number": "87",
+ "label": "Haute-Vienne"
+ }
+ },
+ {
+ "pk": 89,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 41,
+ "number": "88",
+ "label": "Vosges"
+ }
+ },
+ {
+ "pk": 90,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 39,
+ "number": "89",
+ "label": "Yonne"
+ }
+ },
+ {
+ "pk": 91,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 43,
+ "number": "90",
+ "label": "Territoire de Belfort"
+ }
+ },
+ {
+ "pk": 92,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 33,
+ "number": "91",
+ "label": "Essonne"
+ }
+ },
+ {
+ "pk": 93,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 33,
+ "number": "92",
+ "label": "Hauts-de-Seine"
+ }
+ },
+ {
+ "pk": 94,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 33,
+ "number": "93",
+ "label": "Seine-Saint-Denis"
+ }
+ },
+ {
+ "pk": 95,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 33,
+ "number": "94",
+ "label": "Val-de-Marne"
+ }
+ },
+ {
+ "pk": 96,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 33,
+ "number": "95",
+ "label": "Val-d'Oise"
+ }
+ },
+ {
+ "pk": 97,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 28,
+ "number": "971",
+ "label": "Guadeloupe"
+ }
+ },
+ {
+ "pk": 98,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 29,
+ "number": "972",
+ "label": "Martinique"
+ }
+ },
+ {
+ "pk": 99,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 30,
+ "number": "973",
+ "label": "Guyane"
+ }
+ },
+ {
+ "pk": 100,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 31,
+ "number": "974",
+ "label": "La R\u00e9union"
+ }
+ },
+ {
+ "pk": 101,
+ "model": "ishtar_common.department",
+ "fields": {
+ "state": 32,
+ "number": "976",
+ "label": "Mayotte"
+ }
+ }
+] \ No newline at end of file
diff --git a/ishtar_common/management/commands/update_towns.py b/ishtar_common/management/commands/update_towns.py
new file mode 100644
index 000000000..fa201b677
--- /dev/null
+++ b/ishtar_common/management/commands/update_towns.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import csv
+import datetime, time
+
+from django.conf import settings
+from django.core.management.base import BaseCommand, CommandError
+
+from ishtar_common import tasks
+
+class Command(BaseCommand):
+ help = "Update department for french towns"
+
+ def handle(self, *args, **options):
+ self.stdout.write("* Loading towns\n")
+ self.stdout.flush()
+ created, updated = tasks.update_towns()
+ self.stdout.write("%d towns created, %s towns updated\n\n" % (created,
+ updated))
+ self.stdout.flush()
+
diff --git a/ishtar_common/migrations/0017_auto__add_state__add_field_department_state.py b/ishtar_common/migrations/0017_auto__add_state__add_field_department_state.py
new file mode 100644
index 000000000..becf3a0ae
--- /dev/null
+++ b/ishtar_common/migrations/0017_auto__add_state__add_field_department_state.py
@@ -0,0 +1,243 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Adding model 'State'
+ db.create_table('ishtar_common_state', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('label', self.gf('django.db.models.fields.CharField')(max_length=30)),
+ ('number', self.gf('django.db.models.fields.CharField')(unique=True, max_length=3)),
+ ))
+ db.send_create_signal('ishtar_common', ['State'])
+
+ # Adding field 'Department.state'
+ db.add_column('ishtar_common_department', 'state',
+ self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ishtar_common.State'], null=True, blank=True),
+ keep_default=False)
+
+
+ def backwards(self, orm):
+ # Deleting model 'State'
+ db.delete_table('ishtar_common_state')
+
+ # Deleting field 'Department.state'
+ db.delete_column('ishtar_common_department', 'state_id')
+
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'ishtar_common.arrondissement': {
+ 'Meta': {'object_name': 'Arrondissement'},
+ 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'})
+ },
+ 'ishtar_common.author': {
+ 'Meta': {'object_name': 'Author'},
+ 'author_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.AuthorType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'person': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'author'", 'to': "orm['ishtar_common.Person']"})
+ },
+ 'ishtar_common.authortype': {
+ 'Meta': {'object_name': 'AuthorType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'ishtar_common.canton': {
+ 'Meta': {'object_name': 'Canton'},
+ 'arrondissement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Arrondissement']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'})
+ },
+ 'ishtar_common.department': {
+ 'Meta': {'ordering': "['number']", 'object_name': 'Department'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
+ 'number': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '3'}),
+ 'state': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.State']", 'null': 'True', 'blank': 'True'})
+ },
+ 'ishtar_common.documenttemplate': {
+ 'Meta': {'ordering': "['associated_object_name']", 'object_name': 'DocumentTemplate'},
+ 'associated_object_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'template': ('django.db.models.fields.files.FileField', [], {'max_length': '100'})
+ },
+ 'ishtar_common.globalvar': {
+ 'Meta': {'ordering': "['slug']", 'object_name': 'GlobalVar'},
+ 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}),
+ 'value': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'ishtar_common.historicalorganization': {
+ 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalOrganization'},
+ 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
+ 'history_creator_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'history_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'history_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'history_modifier_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'history_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
+ 'history_user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}),
+ 'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}),
+ 'merge_key': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
+ 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '300'}),
+ 'organization_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
+ 'town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'})
+ },
+ 'ishtar_common.import': {
+ 'Meta': {'object_name': 'Import'},
+ 'creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'end_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'error_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'imported_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
+ 'importer_type': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'result_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'seconds_remaining': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'state': ('django.db.models.fields.CharField', [], {'max_length': '2'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.IshtarUser']"})
+ },
+ 'ishtar_common.ishtaruser': {
+ 'Meta': {'object_name': 'IshtarUser', '_ormbases': ['auth.User']},
+ 'person': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ishtaruser'", 'unique': 'True', 'to': "orm['ishtar_common.Person']"}),
+ 'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'})
+ },
+ 'ishtar_common.organization': {
+ 'Meta': {'object_name': 'Organization'},
+ 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
+ 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'merge_candidate': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_candidate_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Organization']"}),
+ 'merge_exclusion': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_exclusion_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Organization']"}),
+ 'merge_key': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
+ 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '300'}),
+ 'organization_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.OrganizationType']"}),
+ 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
+ 'town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'})
+ },
+ 'ishtar_common.organizationtype': {
+ 'Meta': {'ordering': "('label',)", 'object_name': 'OrganizationType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'ishtar_common.person': {
+ 'Meta': {'object_name': 'Person'},
+ 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'attached_to': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'members'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Organization']"}),
+ 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
+ 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}),
+ 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'merge_candidate': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_candidate_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}),
+ 'merge_exclusion': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_exclusion_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}),
+ 'merge_key': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
+ 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+ 'person_types': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ishtar_common.PersonType']", 'symmetrical': 'False'}),
+ 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
+ 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
+ 'raw_name': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
+ 'surname': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '2'}),
+ 'town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'})
+ },
+ 'ishtar_common.persontype': {
+ 'Meta': {'ordering': "('label',)", 'object_name': 'PersonType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['auth.Group']", 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'ishtar_common.sourcetype': {
+ 'Meta': {'object_name': 'SourceType'},
+ 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'ishtar_common.state': {
+ 'Meta': {'ordering': "['number']", 'object_name': 'State'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
+ 'number': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '3'})
+ },
+ 'ishtar_common.town': {
+ 'Meta': {'ordering': "['numero_insee']", 'object_name': 'Town'},
+ 'canton': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Canton']", 'null': 'True', 'blank': 'True'}),
+ 'center': ('django.contrib.gis.db.models.fields.PointField', [], {'srid': '27572', 'null': 'True', 'blank': 'True'}),
+ 'departement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'numero_insee': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '6'}),
+ 'surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
+ }
+ }
+
+ complete_apps = ['ishtar_common'] \ No newline at end of file
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index fe907f014..358c66572 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -879,9 +879,22 @@ class DocumentTemplate(models.Model):
missing = ooo_replace(self.template, output_name, values)
return output_name
+class State(models.Model):
+ label = models.CharField(_(u"Label"), max_length=30)
+ number = models.CharField(_(u"Number"), unique=True, max_length=3)
+
+ class Meta:
+ verbose_name = _(u"State")
+ ordering = ['number']
+
+ def __unicode__(self):
+ return self.label
+
class Department(models.Model):
label = models.CharField(_(u"Label"), max_length=30)
number = models.CharField(_(u"Number"), unique=True, max_length=3)
+ state = models.ForeignKey('State', verbose_name=_(u"State"), blank=True,
+ null=True)
class Meta:
verbose_name = _(u"Department")
@@ -889,7 +902,7 @@ class Department(models.Model):
ordering = ['number']
def __unicode__(self):
- return u"%s (%s)" % (self.label, self.number)
+ return self.label
class Address(BaseHistorizedItem):
address = models.TextField(_(u"Address"), null=True, blank=True)