#18368: LayerMapping.save() should be able to set attributes on created model
instances
-----------------------------+--------------------------------------
     Reporter:  geoffhing@…  |                    Owner:  nobody
         Type:  New feature  |                   Status:  reopened
    Component:  GIS          |                  Version:  1.4
     Severity:  Normal       |               Resolution:
     Keywords:               |             Triage Stage:  Unreviewed
    Has patch:  0            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  0
Easy pickings:  0            |                    UI/UX:  0
-----------------------------+--------------------------------------
Changes (by geoffhing@…):

 * status:  closed => reopened
 * resolution:  wontfix =>


Comment:

 @claudep, I just want to make sure you're clear on the use case that made
 me request this.  I'm bulk loading geometries using LayerMapping from a
 management command (code at
 
https://github.com/PitonFoundation/atlas/blob/locations_places/apps/storybase_geo/management/commands/loadplaces.py).
 The reason I needed to be able to pass additional model attributes to
 LayerMapping.save() was to set a ForeignKey field to a model representing
 levels of a geographic hierarchy.  In my use case, this field can be null,
 so that can't be used to identify the newly-created values.  Also,
 geometries may be loaded at different times and for different levels of
 the geo hierarchy, so a default value for that field doesn't make sense.

 Also, maybe I'm missing something, but I couldn't seem to find a way to
 retrieve the model instances created by LayerMapping.save().  Certainly, I
 could add a field to the model to indicate whether or not the model
 instances had been post-processed in a second pass, but preferred not to
 add fields to the model just to accommodate the occasional data load.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18368#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to