summaryrefslogtreecommitdiff
path: root/lib/python2.7/site-packages/south/tests/fakeapp
diff options
context:
space:
mode:
authorttt2017-05-13 00:29:47 +0530
committerttt2017-05-13 00:29:47 +0530
commitabf599be33b383a6a5baf9493093b2126a622ac8 (patch)
tree4c5ab6e0d935d5e65fabcf0258e4a00dd20a5afa /lib/python2.7/site-packages/south/tests/fakeapp
downloadSBHS-2018-Rpi-abf599be33b383a6a5baf9493093b2126a622ac8.tar.gz
SBHS-2018-Rpi-abf599be33b383a6a5baf9493093b2126a622ac8.tar.bz2
SBHS-2018-Rpi-abf599be33b383a6a5baf9493093b2126a622ac8.zip
added all server files
Diffstat (limited to 'lib/python2.7/site-packages/south/tests/fakeapp')
-rw-r--r--lib/python2.7/site-packages/south/tests/fakeapp/__init__.py0
-rw-r--r--lib/python2.7/site-packages/south/tests/fakeapp/migrations/0001_spam.py17
-rw-r--r--lib/python2.7/site-packages/south/tests/fakeapp/migrations/0002_eggs.py20
-rw-r--r--lib/python2.7/site-packages/south/tests/fakeapp/migrations/0003_alter_spam.py18
-rw-r--r--lib/python2.7/site-packages/south/tests/fakeapp/migrations/__init__.py0
-rw-r--r--lib/python2.7/site-packages/south/tests/fakeapp/models.py111
6 files changed, 166 insertions, 0 deletions
diff --git a/lib/python2.7/site-packages/south/tests/fakeapp/__init__.py b/lib/python2.7/site-packages/south/tests/fakeapp/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lib/python2.7/site-packages/south/tests/fakeapp/__init__.py
diff --git a/lib/python2.7/site-packages/south/tests/fakeapp/migrations/0001_spam.py b/lib/python2.7/site-packages/south/tests/fakeapp/migrations/0001_spam.py
new file mode 100644
index 0000000..9739648
--- /dev/null
+++ b/lib/python2.7/site-packages/south/tests/fakeapp/migrations/0001_spam.py
@@ -0,0 +1,17 @@
+from south.db import db
+from django.db import models
+
+class Migration:
+
+ def forwards(self):
+ # Model 'Spam'
+ db.create_table("southtest_spam", (
+ ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
+ ('weight', models.FloatField()),
+ ('expires', models.DateTimeField()),
+ ('name', models.CharField(max_length=255))
+ ))
+
+ def backwards(self):
+ db.delete_table("southtest_spam")
+
diff --git a/lib/python2.7/site-packages/south/tests/fakeapp/migrations/0002_eggs.py b/lib/python2.7/site-packages/south/tests/fakeapp/migrations/0002_eggs.py
new file mode 100644
index 0000000..3ec8399
--- /dev/null
+++ b/lib/python2.7/site-packages/south/tests/fakeapp/migrations/0002_eggs.py
@@ -0,0 +1,20 @@
+from south.db import db
+from django.db import models
+
+class Migration:
+
+ def forwards(self):
+
+ Spam = db.mock_model(model_name='Spam', db_table='southtest_spam', db_tablespace='', pk_field_name='id', pk_field_type=models.AutoField)
+
+ db.create_table("southtest_eggs", (
+ ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
+ ('size', models.FloatField()),
+ ('quantity', models.IntegerField()),
+ ('spam', models.ForeignKey(Spam)),
+ ))
+
+ def backwards(self):
+
+ db.delete_table("southtest_eggs")
+
diff --git a/lib/python2.7/site-packages/south/tests/fakeapp/migrations/0003_alter_spam.py b/lib/python2.7/site-packages/south/tests/fakeapp/migrations/0003_alter_spam.py
new file mode 100644
index 0000000..39126c2
--- /dev/null
+++ b/lib/python2.7/site-packages/south/tests/fakeapp/migrations/0003_alter_spam.py
@@ -0,0 +1,18 @@
+from south.db import db
+from django.db import models
+
+class Migration:
+
+ def forwards(self):
+
+ db.alter_column("southtest_spam", 'weight', models.FloatField(null=True))
+
+ def backwards(self):
+
+ db.alter_column("southtest_spam", 'weight', models.FloatField())
+
+ models = {
+ "fakeapp.bug135": {
+ 'date': ('models.DateTimeField', [], {'default': 'datetime.datetime(2009, 5, 6, 15, 33, 15, 780013)'}),
+ }
+ }
diff --git a/lib/python2.7/site-packages/south/tests/fakeapp/migrations/__init__.py b/lib/python2.7/site-packages/south/tests/fakeapp/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lib/python2.7/site-packages/south/tests/fakeapp/migrations/__init__.py
diff --git a/lib/python2.7/site-packages/south/tests/fakeapp/models.py b/lib/python2.7/site-packages/south/tests/fakeapp/models.py
new file mode 100644
index 0000000..cc39eb7
--- /dev/null
+++ b/lib/python2.7/site-packages/south/tests/fakeapp/models.py
@@ -0,0 +1,111 @@
+# -*- coding: UTF-8 -*-
+
+from django.db import models
+from django.contrib.auth.models import User as UserAlias
+
+from south.modelsinspector import add_introspection_rules
+
+on_delete_is_available = hasattr(models, "PROTECT") # models here is django.db.models
+
+def default_func():
+ return "yays"
+
+# An empty case.
+class Other1(models.Model): pass
+
+# Another one
+class Other3(models.Model): pass
+def get_sentinel_object():
+ """
+ A function to return the object to be used in place of any deleted object,
+ when using the SET option for on_delete.
+ """
+ # Create a new one, so we always have an instance to test with. Can't work!
+ return Other3()
+
+# Nastiness.
+class HorribleModel(models.Model):
+ "A model to test the edge cases of model parsing"
+
+ ZERO, ONE = 0, 1
+
+ # First, some nice fields
+ name = models.CharField(max_length=255)
+ short_name = models.CharField(max_length=50)
+ slug = models.SlugField(unique=True)
+
+ # A ForeignKey, to a model above, and then below
+ o1 = models.ForeignKey(Other1)
+ o2 = models.ForeignKey('Other2')
+
+ if on_delete_is_available:
+ o_set_null_on_delete = models.ForeignKey('Other3', null=True, on_delete=models.SET_NULL)
+ o_cascade_delete = models.ForeignKey('Other3', null=True, on_delete=models.CASCADE, related_name="cascademe")
+ o_protect = models.ForeignKey('Other3', null=True, on_delete=models.PROTECT, related_name="dontcascademe")
+ o_default_on_delete = models.ForeignKey('Other3', null=True, default=1, on_delete=models.SET_DEFAULT, related_name="setmedefault")
+ o_set_on_delete_function = models.ForeignKey('Other3', null=True, default=1, on_delete=models.SET(get_sentinel_object), related_name="setsentinel")
+ o_set_on_delete_value = models.ForeignKey('Other3', null=True, default=1, on_delete=models.SET(get_sentinel_object()), related_name="setsentinelwithactualvalue") # dubious case
+ o_no_action_on_delete = models.ForeignKey('Other3', null=True, default=1, on_delete=models.DO_NOTHING, related_name="deletemeatyourperil")
+
+
+ # Now to something outside
+ user = models.ForeignKey(UserAlias, related_name="horribles")
+
+ # Unicode!
+ code = models.CharField(max_length=25, default="↑↑↓↓←→←→BA")
+
+ # Odd defaults!
+ class_attr = models.IntegerField(default=ZERO)
+ func = models.CharField(max_length=25, default=default_func)
+
+ # Time to get nasty. Define a non-field choices, and use it
+ choices = [('hello', '1'), ('world', '2')]
+ choiced = models.CharField(max_length=20, choices=choices)
+
+ class Meta:
+ db_table = "my_fave"
+ verbose_name = "Dr. Strangelove," + \
+ """or how I learned to stop worrying
+and love the bomb"""
+
+ # Now spread over multiple lines
+ multiline = \
+ models.TextField(
+ )
+
+# Special case.
+class Other2(models.Model):
+ # Try loading a field without a newline after it (inspect hates this)
+ close_but_no_cigar = models.PositiveIntegerField(primary_key=True)
+
+class CustomField(models.IntegerField):
+ def __init__(self, an_other_model, **kwargs):
+ super(CustomField, self).__init__(**kwargs)
+ self.an_other_model = an_other_model
+
+add_introspection_rules([
+ (
+ [CustomField],
+ [],
+ {'an_other_model': ('an_other_model', {})},
+ ),
+], ['^south\.tests\.fakeapp\.models\.CustomField'])
+
+class BaseModel(models.Model):
+ pass
+
+class SubModel(BaseModel):
+ others = models.ManyToManyField(Other1)
+ custom = CustomField(Other2)
+
+class CircularA(models.Model):
+ c = models.ForeignKey('CircularC')
+
+class CircularB(models.Model):
+ a = models.ForeignKey(CircularA)
+
+class CircularC(models.Model):
+ b = models.ForeignKey(CircularB)
+
+class Recursive(models.Model):
+ self = models.ForeignKey('self')