Ticket #17018: layermapping.2.patch

File layermapping.2.patch, 975 bytes (added by Glen Robertson, 13 years ago)

updated patch

  • django/contrib/gis/utils/layermapping.py

     
    295295            elif isinstance(model_field, models.base.ModelBase):
    296296                # The related _model_, not a field was passed in -- indicating
    297297                # another mapping for the related Model.
    298                 val = self.verify_fk(feat, model_field, ogr_name)
     298                try:
     299                    val = self.verify_fk(feat, model_field, ogr_name)
     300                except MissingForeignKey:
     301                    if self.model._meta.get_field(field_name).null:
     302                        val = None
     303                    else:
     304                        raise
    299305            else:
    300306                # Otherwise, verify OGR Field type.
    301307                val = self.verify_ogr_field(feat[ogr_name], model_field)
Back to Top