Permalink
Browse files

Reverted the introduction of shared_models.

The recent improvements should make shared_models obsolete.

This reverts commit 1059da8, reversing
changes made to 4fa7f3c.
  • Loading branch information...
1 parent f5d4849 commit af70dfcf317fd045df69917baca7bc0c58e2fd32 @apollo13 apollo13 committed Jun 10, 2013
@@ -10,16 +10,29 @@
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
-from shared_models.models import Author, Book
+class Author(models.Model):
+ name = models.CharField(max_length=100)
+ class Meta:
+ 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(Book)
+ articles = models.ManyToManyField(Article)
name = models.CharField(max_length=100)
class Meta:
ordering = ('name', )
-
@python_2_unicode_compatible
class Season(models.Model):
year = models.PositiveSmallIntegerField()
@@ -28,7 +41,6 @@ class Season(models.Model):
def __str__(self):
return six.text_type(self.year)
-
@python_2_unicode_compatible
class Game(models.Model):
season = models.ForeignKey(Season, related_name='games')
@@ -38,7 +50,6 @@ class Game(models.Model):
def __str__(self):
return "%s at %s" % (self.away, self.home)
-
@python_2_unicode_compatible
class Player(models.Model):
name = models.CharField(max_length=100)
View
Oops, something went wrong.
View
@@ -29,7 +29,6 @@
]
ALWAYS_INSTALLED_APPS = [
- 'shared_models',
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sites',
No changes.
@@ -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 django.db import models
from django.test import TestCase
-from shared_models.models import Author, Book
+from .models import Author, Book
class SignalsRegressTests(TestCase):
@@ -77,7 +77,7 @@ def test_model_signals(self):
"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), [
"pre_save signal, Snow Crash",
"post_save signal, Snow Crash",
@@ -87,7 +87,7 @@ def test_model_signals(self):
def test_m2m_signals(self):
""" 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)
a1 = Author(name='Neal Stephenson')
self.get_signal_output(a1.save)
@@ -3,7 +3,7 @@
from django.core import management
from django.utils import six
-from shared_models import models
+from . import models
PRE_SYNCDB_ARGS = ['app', 'create_models', 'verbosity', 'interactive', 'db']

0 comments on commit af70dfc

Please sign in to comment.