diff options
-rw-r--r-- | scripts/2016-09-29-clean-dup-towns-pdl.py | 11 |
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])) |