Reverted the introduction of shared_models.
The recent improvements should make shared_models obsolete. This reverts commit1059da8de6
, reversing changes made to4fa7f3cdd9
.
This commit is contained in:
parent
f5d4849cbe
commit
af70dfcf31
|
@ -10,15 +10,28 @@ from django.db import models
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
||||||
from shared_models.models import Author, Book
|
|
||||||
|
|
||||||
|
class Author(models.Model):
|
||||||
class Tag(models.Model):
|
|
||||||
articles = models.ManyToManyField(Book)
|
|
||||||
name = models.CharField(max_length=100)
|
name = models.CharField(max_length=100)
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('name', )
|
ordering = ('name', )
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
|
class Article(models.Model):
|
||||||
|
headline = models.CharField(max_length=100)
|
||||||
|
pub_date = models.DateTimeField()
|
||||||
|
author = models.ForeignKey(Author, blank=True, null=True)
|
||||||
|
class Meta:
|
||||||
|
ordering = ('-pub_date', 'headline')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.headline
|
||||||
|
|
||||||
|
class Tag(models.Model):
|
||||||
|
articles = models.ManyToManyField(Article)
|
||||||
|
name = models.CharField(max_length=100)
|
||||||
|
class Meta:
|
||||||
|
ordering = ('name', )
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Season(models.Model):
|
class Season(models.Model):
|
||||||
|
@ -28,7 +41,6 @@ class Season(models.Model):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return six.text_type(self.year)
|
return six.text_type(self.year)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Game(models.Model):
|
class Game(models.Model):
|
||||||
season = models.ForeignKey(Season, related_name='games')
|
season = models.ForeignKey(Season, related_name='games')
|
||||||
|
@ -38,7 +50,6 @@ class Game(models.Model):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s at %s" % (self.away, self.home)
|
return "%s at %s" % (self.away, self.home)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Player(models.Model):
|
class Player(models.Model):
|
||||||
name = models.CharField(max_length=100)
|
name = models.CharField(max_length=100)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -29,7 +29,6 @@ SUBDIRS_TO_SKIP = [
|
||||||
]
|
]
|
||||||
|
|
||||||
ALWAYS_INSTALLED_APPS = [
|
ALWAYS_INSTALLED_APPS = [
|
||||||
'shared_models',
|
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.sites',
|
'django.contrib.sites',
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
from django.db import models
|
|
||||||
from django.utils import timezone
|
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
|
|
||||||
|
|
||||||
class Tag(models.Model):
|
|
||||||
name = models.CharField(max_length=255)
|
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Author(models.Model):
|
|
||||||
name = models.CharField(max_length=100)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.name
|
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Book(models.Model):
|
|
||||||
name = models.CharField(max_length=200)
|
|
||||||
pages = models.IntegerField(default=0)
|
|
||||||
author = models.ForeignKey(Author, null=True)
|
|
||||||
pubdate = models.DateTimeField()
|
|
||||||
tags = models.ManyToManyField(Tag)
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
ordering = ['-pubdate', 'name']
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.name
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
from django.db import models
|
||||||
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
|
class Author(models.Model):
|
||||||
|
name = models.CharField(max_length=20)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
|
class Book(models.Model):
|
||||||
|
name = models.CharField(max_length=20)
|
||||||
|
authors = models.ManyToManyField(Author)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
|
@ -3,7 +3,7 @@ from __future__ import absolute_import
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from shared_models.models import Author, Book
|
from .models import Author, Book
|
||||||
|
|
||||||
|
|
||||||
class SignalsRegressTests(TestCase):
|
class SignalsRegressTests(TestCase):
|
||||||
|
@ -77,7 +77,7 @@ class SignalsRegressTests(TestCase):
|
||||||
"Is created"
|
"Is created"
|
||||||
])
|
])
|
||||||
|
|
||||||
b1 = Book(name='Snow Crash', pubdate='2012-02-02 12:00')
|
b1 = Book(name='Snow Crash')
|
||||||
self.assertEqual(self.get_signal_output(b1.save), [
|
self.assertEqual(self.get_signal_output(b1.save), [
|
||||||
"pre_save signal, Snow Crash",
|
"pre_save signal, Snow Crash",
|
||||||
"post_save signal, Snow Crash",
|
"post_save signal, Snow Crash",
|
||||||
|
@ -87,7 +87,7 @@ class SignalsRegressTests(TestCase):
|
||||||
def test_m2m_signals(self):
|
def test_m2m_signals(self):
|
||||||
""" Assigning and removing to/from m2m shouldn't generate an m2m signal """
|
""" Assigning and removing to/from m2m shouldn't generate an m2m signal """
|
||||||
|
|
||||||
b1 = Book(name='Snow Crash', pubdate='2012-02-02 12:00')
|
b1 = Book(name='Snow Crash')
|
||||||
self.get_signal_output(b1.save)
|
self.get_signal_output(b1.save)
|
||||||
a1 = Author(name='Neal Stephenson')
|
a1 = Author(name='Neal Stephenson')
|
||||||
self.get_signal_output(a1.save)
|
self.get_signal_output(a1.save)
|
||||||
|
|
|
@ -3,7 +3,7 @@ from django.test import TestCase
|
||||||
from django.core import management
|
from django.core import management
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
|
||||||
from shared_models import models
|
from . import models
|
||||||
|
|
||||||
|
|
||||||
PRE_SYNCDB_ARGS = ['app', 'create_models', 'verbosity', 'interactive', 'db']
|
PRE_SYNCDB_ARGS = ['app', 'create_models', 'verbosity', 'interactive', 'db']
|
||||||
|
|
Loading…
Reference in New Issue