summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-10-03 10:08:55 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-10-03 10:08:55 +0200
commit71cfdd1c406e97757546d20ba4e189246d68734e (patch)
treebb604840f122d96da15db22bc76b5e8b32adc7e8 /scripts
parent63f6e4badfd7bc8aade33296195f6cf90ecb3dc4 (diff)
downloadIshtar-71cfdd1c406e97757546d20ba4e189246d68734e.tar.bz2
Ishtar-71cfdd1c406e97757546d20ba4e189246d68734e.zip
Maintenance script for de-dup towns (2)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/2016-09-29-clean-dup-towns-pdl.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/2016-09-29-clean-dup-towns-pdl.py b/scripts/2016-09-29-clean-dup-towns-pdl.py
index f454a7cac..ebacb2fdf 100644
--- a/scripts/2016-09-29-clean-dup-towns-pdl.py
+++ b/scripts/2016-09-29-clean-dup-towns-pdl.py
@@ -1,4 +1,4 @@
-from ishtar_common import Town
+from ishtar_common.models import Town
dup_nb = 0
@@ -37,10 +37,15 @@ strange = []
for town in Town.objects.exclude(pk__in=pdl):
if (town.file_main.count() or town.parcels.count() or town.file.count() or
town.operations.count()):
- strange.append(town)
+ strange.append((town, town.file_main.count(), town.parcels.count(),
+ town.file.count(), town.operations.count()))
continue
town.delete()
+
print('* Problems with:')
for t in strange:
- print(t)
+ print("{}: \n\t* {} ville principale dossier\n\t* {} parcelles\n\t* {} "
+ "villes pour"
+ " dossier\n\t* {} ville pour operation".format(t[0], t[1], t[2],
+ t[3], t[4]))