Permalink
Browse files

Fixed bug with south migration additions, added demo models

  • Loading branch information...
1 parent ad15c5e commit 09da3de41d773c229094a0ef5a9cc8facf1eab61 @jkatz committed Sep 14, 2011
View
No changes.
View
@@ -0,0 +1,7 @@
+from django.contrib import admin
+
+from models import *
+
+admin.site.register(Map)
+admin.site.register(Lotto)
+admin.site.register(Subscription)
@@ -0,0 +1,71 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+
+ # Adding model 'Map'
+ db.create_table('demo_map', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
+ ('geocode', self.gf('ext.models.PointField')()),
+ ))
+ db.send_create_signal('demo', ['Map'])
+
+ # Adding model 'Lotto'
+ db.create_table('demo_lotto', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
+ ('numbers', self.gf('ext.models.IntegerArrayField')(null=True, blank=True)),
+ ))
+ db.send_create_signal('demo', ['Lotto'])
+
+ # Adding model 'Subscription'
+ db.create_table('demo_subscription', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
+ ('period', self.gf('ext.models.DayIntervalField')()),
+ ('price', self.gf('ext.models.MoneyField')(null=True, blank=True)),
+ ))
+ db.send_create_signal('demo', ['Subscription'])
+
+
+ def backwards(self, orm):
+
+ # Deleting model 'Map'
+ db.delete_table('demo_map')
+
+ # Deleting model 'Lotto'
+ db.delete_table('demo_lotto')
+
+ # Deleting model 'Subscription'
+ db.delete_table('demo_subscription')
+
+
+ models = {
+ 'demo.lotto': {
+ 'Meta': {'object_name': 'Lotto'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'numbers': ('ext.models.IntegerArrayField', [], {'null': 'True', 'blank': 'True'})
+ },
+ 'demo.map': {
+ 'Meta': {'object_name': 'Map'},
+ 'geocode': ('ext.models.PointField', [], {}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+ },
+ 'demo.subscription': {
+ 'Meta': {'object_name': 'Subscription'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'period': ('ext.models.DayIntervalField', [], {}),
+ 'price': ('ext.models.MoneyField', [], {'null': 'True', 'blank': 'True'})
+ }
+ }
+
+ complete_apps = ['demo']
No changes.
View
@@ -0,0 +1,15 @@
+from django.db import models
+from ext.models import DayIntervalField, EnumField, IntegerArrayField, MoneyField, PointField
+
+class Map(models.Model):
+ name = models.CharField(max_length=255)
+ geocode = PointField()
+
+class Lotto(models.Model):
+ name = models.CharField(max_length=255)
+ numbers = IntegerArrayField(blank=True, null=True)
+
+class Subscription(models.Model):
+ name = models.CharField(max_length=255)
+ period = DayIntervalField()
+ price = MoneyField(blank=True, null=True)
View
@@ -0,0 +1,16 @@
+"""
+This file demonstrates writing tests using the unittest module. These will pass
+when you run "manage.py test".
+
+Replace this with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+
+class SimpleTest(TestCase):
+ def test_basic_addition(self):
+ """
+ Tests that 1 + 1 always equals 2.
+ """
+ self.assertEqual(1 + 1, 2)
View
@@ -0,0 +1 @@
+# Create your views here.
View
@@ -121,8 +121,8 @@ def __init__(self, *args, **kwargs):
def db_type(self, connection):
return 'point'
-add_introspection_rules([], ["^ext\.DayIntervalField"])
-add_introspection_rules([], ["^ext\.EnumField"])
-add_introspection_rules([], ["^ext\.IntegerArrayField"])
-add_introspection_rules([], ["^ext\.MoneyField"])
-add_introspection_rules([], ["^ext\.PointField"])
+add_introspection_rules([], ["^ext\.models\.DayIntervalField"])
+add_introspection_rules([], ["^ext\.models\.EnumField"])
+add_introspection_rules([], ["^ext\.models\.IntegerArrayField"])
+add_introspection_rules([], ["^ext\.models\.MoneyField"])
+add_introspection_rules([], ["^ext\.models\.PointField"])
View
@@ -122,6 +122,7 @@
'django.contrib.admin',
'django.contrib.admindocs',
'ext',
+ 'demo',
'south', # handles migrations
)

0 comments on commit 09da3de

Please sign in to comment.