Exemplo n.º 1
0
class City(SimpleModel):
    name = models.CharField(max_length=50)
    state = models.CharField(max_length=2)
    location = models.ForeignKey(Location, models.CASCADE)

    def __str__(self):
        return self.name
Exemplo n.º 2
0
class Parcel(SimpleModel):
    name = models.CharField(max_length=30)
    city = models.ForeignKey(City, models.CASCADE)
    center1 = models.PointField()
    # Throwing a curveball w/`db_column` here.
    center2 = models.PointField(srid=2276, db_column='mycenter')
    border1 = models.PolygonField()
    border2 = models.PolygonField(srid=2276)

    def __str__(self):
        return self.name
Exemplo n.º 3
0
class Book(SimpleModel):
    title = models.CharField(max_length=100)
    author = models.ForeignKey(Author, models.SET_NULL, related_name='books', null=True)
Exemplo n.º 4
0
class Article(SimpleModel):
    title = models.CharField(max_length=100)
    author = models.ForeignKey(Author, models.CASCADE, unique=True)
Exemplo n.º 5
0
class DirectoryEntry(SimpleModel):
    listing_text = models.CharField(max_length=50)
    location = models.ForeignKey(AugmentedLocation, models.CASCADE)
Exemplo n.º 6
0
     fields=[
         ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
         ('name', models.CharField(max_length=100, unique=True)),
         ('geom', models.MultiPolygonField(srid=4326)),
     ],
     options={
     },
     bases=(models.Model,),
 ),
 migrations.CreateModel(
     name='Household',
     fields=[
         ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
         ('neighborhood', models.ForeignKey(
             'gis_migrations.Neighborhood',
             models.SET_NULL,
             to_field='id',
             null=True,
         )),
         ('address', models.CharField(max_length=100)),
         ('zip_code', models.IntegerField(null=True, blank=True)),
         ('geom', models.PointField(srid=4326, geography=True)),
     ],
     options={
     },
     bases=(models.Model,),
 ),
 migrations.CreateModel(
     name='Family',
     fields=[
         ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
         ('name', models.CharField(max_length=100, unique=True)),
Exemplo n.º 7
0
class MultiFields(NamedModel):
    city = models.ForeignKey(City, models.CASCADE)
    point = models.PointField()
    poly = models.PolygonField()
Exemplo n.º 8
0
class County(NamedModel):
    state = models.ForeignKey(State, models.CASCADE)
    mpoly = models.MultiPolygonField(srid=4269,
                                     null=True)  # Multipolygon in NAD83