From 111c10e31738e562e5e391d17e5ad5645f448259 Mon Sep 17 00:00:00 2001 From: James Turk Date: Thu, 28 May 2015 08:41:14 -0400 Subject: [PATCH] fix models --- tests/migrations/0001_initial.py | 53 ++++++++++++++++++++++++++++++++ tests/migrations/__init__.py | 0 tests/models.py | 2 +- 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 tests/migrations/0001_initial.py create mode 100644 tests/migrations/__init__.py diff --git a/tests/migrations/0001_initial.py b/tests/migrations/0001_initial.py new file mode 100644 index 0000000..2d04c61 --- /dev/null +++ b/tests/migrations/0001_initial.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Group', + fields=[ + ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('name', models.CharField(max_length=100)), + ], + ), + migrations.CreateModel( + name='Number', + fields=[ + ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('number', models.CharField(max_length=10)), + ], + ), + migrations.CreateModel( + name='Person', + fields=[ + ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('name', models.CharField(max_length=100)), + ('friends', models.ManyToManyField(to='tests.Person', related_name='friends_rel_+')), + ], + ), + migrations.CreateModel( + name='SSN', + fields=[ + ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('number', models.CharField(max_length=10)), + ('person', models.OneToOneField(to='tests.Person')), + ], + ), + migrations.AddField( + model_name='number', + name='person', + field=models.ForeignKey(to='tests.Person', related_name='numbers'), + ), + migrations.AddField( + model_name='group', + name='people', + field=models.ManyToManyField(to='tests.Person'), + ), + ] diff --git a/tests/migrations/__init__.py b/tests/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/models.py b/tests/models.py index bcf7cae..1aa860c 100644 --- a/tests/models.py +++ b/tests/models.py @@ -12,7 +12,7 @@ class Number(models.Model): class SSN(models.Model): - person = models.OneToOneField(Person) + person = models.OneToOneField(Person, related_name='ssn') number = models.CharField(max_length=10)