Code

Ticket #15277: 15277.1.patch

File 15277.1.patch, 1.2 KB (added by jpaulett, 3 years ago)
  • django/contrib/gis/utils/ogrinspect.py

    diff --git django/contrib/gis/utils/ogrinspect.py django/contrib/gis/utils/ogrinspect.py
    index fe4443c..aa4e209 100644
    Author: Travis Pinney, Dane Springmeyer, & Justin Bronn 
    88from itertools import izip 
    99# Requires GDAL to use. 
    1010from django.contrib.gis.gdal import DataSource 
    11 from django.contrib.gis.gdal.field import OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString 
     11from django.contrib.gis.gdal.field import OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString, OFTTime 
    1212 
    1313def mapping(data_source, geom_name='geom', layer_key=0, multi_geom=False): 
    1414    """ 
    def _ogrinspect(data_source, model_name, geom_name='geom', layer_key=0, srid=Non 
    189189            yield '    %s = models.DateField(%s)' % (mfield, kwargs_str[2:]) 
    190190        elif field_type is OFTDateTime: 
    191191            yield '    %s = models.DateTimeField(%s)' % (mfield, kwargs_str[2:]) 
    192         elif field_type is OFTDate: 
     192        elif field_type is OFTTime: 
    193193            yield '    %s = models.TimeField(%s)' % (mfield, kwargs_str[2:]) 
    194194        else: 
    195195            raise TypeError('Unknown field type %s in %s' % (field_type, mfield))