From 7b397b211a66672a522fc4e1814df853326e7b55 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 10 Jul 2015 21:17:59 +0200 Subject: Parcel management: copy parcel from file to operation when associating a parcel from the file --- archaeological_operations/wizards.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'archaeological_operations/wizards.py') diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py index b31e7b7f6..081281d8a 100644 --- a/archaeological_operations/wizards.py +++ b/archaeological_operations/wizards.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2012-2014 Étienne Loks +# Copyright (C) 2012-2015 Étienne Loks # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -111,10 +111,11 @@ class OperationWizard(Wizard): parcels = [] current_parcels = [] operation = self.get_current_object() - for parcel in operation.parcels.all(): - current_parcels.append((parcel.town, parcel.section, - parcel.parcel_number)) - parcels.append((parcel.pk, parcel.short_label)) + if operation: + for parcel in operation.parcels.all(): + current_parcels.append((parcel.town, parcel.section, + parcel.parcel_number)) + parcels.append((parcel.pk, parcel.short_label)) try: for parcel in file.parcels.all(): if (parcel.town, parcel.section, parcel.parcel_number) \ -- cgit v1.2.3