diff options
| author | Jeremy Dunck <jdunck@gmail.com> | 2008-03-30 21:45:39 +0000 |
|---|---|---|
| committer | Jeremy Dunck <jdunck@gmail.com> | 2008-03-30 21:45:39 +0000 |
| commit | f273b371a4c0e46fcdc97c68f459f8da0b777ca7 (patch) | |
| tree | ce4071af7241471a12bd294a10d6d48981934b44 | |
| parent | 2efc34dc5e65da792700af6594c537104cbee9dc (diff) | |
[gis] Tweaked layermapping to note updates to unique'd models.
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@7389 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/gis/utils/layermapping.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/contrib/gis/utils/layermapping.py b/django/contrib/gis/utils/layermapping.py index 3b85b3fac3..40d2e97278 100644 --- a/django/contrib/gis/utils/layermapping.py +++ b/django/contrib/gis/utils/layermapping.py @@ -597,6 +597,7 @@ class LayerMapping(object): stream.write('Ignoring Feature ID %s because: %s\n' % (feat.fid, msg)) else: # Constructing the model using the keyword args + is_update = False if self.unique: # If we want unique models on a particular field, handle the # geometry appropriately. @@ -605,6 +606,7 @@ class LayerMapping(object): # the unique model. u_kwargs = self.unique_kwargs(kwargs) m = self.model.objects.get(**u_kwargs) + is_update = True # Getting the geometry (in OGR form), creating # one from the kwargs WKT, adding in additional @@ -624,7 +626,7 @@ class LayerMapping(object): # Attempting to save. m.save() num_saved += 1 - if verbose: stream.write('Saved: %s\n' % m) + if verbose: stream.write('%s: %s\n' % (is_update and 'Updated' or 'Saved', m)) except SystemExit: raise except Exception, msg: |
