mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Revert "Began implementing a shared set of test models to speed up tests."
This reverts commit 22b7870e40
.
This commit is contained in:
parent
dfcce4288a
commit
f5d4849cbe
5 changed files with 215 additions and 206 deletions
|
@ -17,7 +17,6 @@ from django.db import models
|
|||
from django.utils import six
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
|
||||
from shared_models.models import Author, Book
|
||||
|
||||
temp_storage_dir = tempfile.mkdtemp(dir=os.environ['DJANGO_TEST_TEMP_DIR'])
|
||||
temp_storage = FileSystemStorage(temp_storage_dir)
|
||||
|
@ -46,13 +45,23 @@ class Category(models.Model):
|
|||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Writer(models.Model):
|
||||
name = models.CharField(max_length=50, help_text='Use both first and last names.')
|
||||
|
||||
class Meta:
|
||||
ordering = ('name',)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Article(models.Model):
|
||||
headline = models.CharField(max_length=50)
|
||||
slug = models.SlugField()
|
||||
pub_date = models.DateField()
|
||||
created = models.DateField(editable=False)
|
||||
writer = models.ForeignKey(Author)
|
||||
writer = models.ForeignKey(Writer)
|
||||
article = models.TextField()
|
||||
categories = models.ManyToManyField(Category, blank=True)
|
||||
status = models.PositiveIntegerField(choices=ARTICLE_STATUS, blank=True, null=True)
|
||||
|
@ -72,12 +81,12 @@ class ImprovedArticle(models.Model):
|
|||
class ImprovedArticleWithParentLink(models.Model):
|
||||
article = models.OneToOneField(Article, parent_link=True)
|
||||
|
||||
class BetterAuthor(Author):
|
||||
class BetterWriter(Writer):
|
||||
score = models.IntegerField()
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class AuthorProfile(models.Model):
|
||||
writer = models.OneToOneField(Author, primary_key=True)
|
||||
class WriterProfile(models.Model):
|
||||
writer = models.OneToOneField(Writer, primary_key=True)
|
||||
age = models.PositiveIntegerField()
|
||||
|
||||
def __str__(self):
|
||||
|
@ -177,6 +186,14 @@ class Inventory(models.Model):
|
|||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
class Book(models.Model):
|
||||
title = models.CharField(max_length=40)
|
||||
author = models.ForeignKey(Writer, blank=True, null=True)
|
||||
special_id = models.IntegerField(blank=True, null=True, unique=True)
|
||||
|
||||
class Meta:
|
||||
unique_together = ('title', 'author')
|
||||
|
||||
class BookXtra(models.Model):
|
||||
isbn = models.CharField(max_length=16, unique=True)
|
||||
suffix1 = models.IntegerField(blank=True, default=0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue