~ubuntu-branches/ubuntu/quantal/python-django/quantal

« back to all changes in this revision

Viewing changes to django/contrib/gis/tests/geoapp/models.py

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant, Eddy Mulyono
  • Date: 2008-09-16 12:18:47 UTC
  • mfrom: (1.1.5 upstream) (4.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080916121847-mg225rg5mnsdqzr0
Tags: 1.0-1ubuntu1
* Merge from Debian (LP: #264191), remaining changes:
  - Run test suite on build.

[Eddy Mulyono]
* Update patch to workaround network test case failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from django.contrib.gis.db import models
 
2
from django.contrib.gis.tests.utils import mysql
 
3
 
 
4
# MySQL spatial indices can't handle NULL geometries.
 
5
null_flag = not mysql
 
6
 
 
7
class Country(models.Model):
 
8
    name = models.CharField(max_length=30)
 
9
    mpoly = models.MultiPolygonField() # SRID, by default, is 4326
 
10
    objects = models.GeoManager()
 
11
    def __unicode__(self): return self.name
 
12
 
 
13
class City(models.Model):
 
14
    name = models.CharField(max_length=30)
 
15
    point = models.PointField() 
 
16
    objects = models.GeoManager()
 
17
    def __unicode__(self): return self.name
 
18
 
 
19
class State(models.Model):
 
20
    name = models.CharField(max_length=30)
 
21
    poly = models.PolygonField(null=null_flag) # Allowing NULL geometries here.
 
22
    objects = models.GeoManager()
 
23
    def __unicode__(self): return self.name
 
24
 
 
25
class Feature(models.Model):
 
26
    name = models.CharField(max_length=20)
 
27
    geom = models.GeometryField()
 
28
    objects = models.GeoManager()
 
29
    def __unicode__(self): return self.name
 
30
 
 
31
class MinusOneSRID(models.Model):
 
32
    geom = models.PointField(srid=-1) # Minus one SRID.
 
33
    objects = models.GeoManager()