Changes between Version 3 and Version 4 of GeoDjangoModelAPI


Ignore:
Timestamp:
Oct 8, 2007, 1:27:36 PM (17 years ago)
Author:
jbronn
Comment:

GeoMixin no longer necessary

Legend:

Unmodified
Added
Removed
Modified
  • GeoDjangoModelAPI

    v3 v4  
    66from django.contrib.gis.db import models
    77
    8 class Zip(models.Model, models.GeoMixin):
     8class Zip(models.Model):
    99  code = models.CharField(maxlength=5)
    1010  poly = models.PolygonField()
     
    3434   * Defaults to True.  Creates a GiST index for the given geometry.  Update the index with the PostgreSQL command {{{VACUUM ANALYZE}}} (may take a while to execute depending on how large your geographic-enabled tables are).  Please note that this is different from the {{{db_index}}} field option since geographic indexes are created in a different manner than regular indexes.
    3535
    36 == GeoMixin ==
     36== !GeoMixin ==
    3737
    38 The [http://code.djangoproject.com/browser/django/branches/gis/django/contrib/gis/db/models/GeoMixin.py GeoMixin] is necessary for all geographic-enabled models.  The mixin provides extra instance methods ([wiki:GeoDjangoDatabaseAPI#ExtraInstanceMethods discussed in the database api docs]) for geographic models without subclassing (aka ModelInheritance) -- which is not yet functional in Django.
     38The [http://code.djangoproject.com/browser/django/branches/gis/django/contrib/gis/db/models/GeoMixin.py GeoMixin] is no longer necessary for all geographic-enabled models as of r6467.  The mixin used to provide extra instance methods ([wiki:GeoDjangoDatabaseAPI#ExtraInstanceMethods discussed in the database api docs]) for geographic models without subclassing (aka ModelInheritance) -- which is not yet functional in Django.
    3939
    40 == GeoManager ==
     40== !GeoManager ==
    4141
    4242In order to conduct geographic queries, each geographic model requires {{{GeoManager}}}.  This [http://www.djangoproject.com/documentation/model-api/#managers manager] allows for the proper SQL construction for geographic queries; thus, without it, all geographic filters will fail.  It should also be noted that a {{{GeoManager}}} will be required even if the model does not have a geographic field itself, ''i.e.'',in the case of a {{{ForeignKey}}} to a geographic model.  For example, if we had an {{{Address}}} model with a {{{ForeignKey}}} to our {{{Zip}}} geographic model:
Back to Top