web/lib/django/contrib/gis/tests/layermap/models.py
changeset 29 cc9b7e14412b
parent 0 0d40e90630ef
equal deleted inserted replaced
28:b758351d191f 29:cc9b7e14412b
    27     name = models.CharField(max_length=20)
    27     name = models.CharField(max_length=20)
    28     length = models.DecimalField(max_digits=6, decimal_places=2)
    28     length = models.DecimalField(max_digits=6, decimal_places=2)
    29     path = models.LineStringField()
    29     path = models.LineStringField()
    30     objects = models.GeoManager()
    30     objects = models.GeoManager()
    31 
    31 
       
    32 # Same as `City` above, but for testing model inheritance.
       
    33 class CityBase(models.Model):
       
    34     name = models.CharField(max_length=25)
       
    35     population = models.IntegerField()
       
    36     density = models.DecimalField(max_digits=7, decimal_places=1)
       
    37     point = models.PointField()
       
    38     objects = models.GeoManager()
       
    39 
       
    40 class ICity1(CityBase):
       
    41     dt = models.DateField()
       
    42     
       
    43 class ICity2(ICity1):
       
    44     dt_time = models.DateTimeField(auto_now=True)
       
    45 
    32 # Mapping dictionaries for the models above.
    46 # Mapping dictionaries for the models above.
    33 co_mapping = {'name' : 'Name',
    47 co_mapping = {'name' : 'Name',
    34               'state' : {'name' : 'State'}, # ForeignKey's use another mapping dictionary for the _related_ Model (State in this case).
    48               'state' : {'name' : 'State'}, # ForeignKey's use another mapping dictionary for the _related_ Model (State in this case).
    35               'mpoly' : 'MULTIPOLYGON', # Will convert POLYGON features into MULTIPOLYGONS.
    49               'mpoly' : 'MULTIPOLYGON', # Will convert POLYGON features into MULTIPOLYGONS.
    36               }
    50               }