1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #7888 -- Handle model inheritance with model formsets correctly. Thanks bpeschier for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8528 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Brian Rosner
2008-08-25 03:51:25 +00:00
parent 05e8c3ecd3
commit 82a1d5471c
4 changed files with 70 additions and 3 deletions

View File

@@ -13,6 +13,12 @@ import tempfile
from django.db import models
from django.core.files.storage import FileSystemStorage
# Python 2.3 doesn't have sorted()
try:
sorted
except NameError:
from django.utils.itercompat import sorted
temp_storage = FileSystemStorage(tempfile.gettempdir())
ARTICLE_STATUS = (
@@ -60,6 +66,9 @@ class ImprovedArticle(models.Model):
class ImprovedArticleWithParentLink(models.Model):
article = models.OneToOneField(Article, parent_link=True)
class BetterWriter(Writer):
pass
class PhoneNumber(models.Model):
phone = models.PhoneNumberField()
description = models.CharField(max_length=20)
@@ -91,7 +100,7 @@ class ImageFile(models.Model):
__test__ = {'API_TESTS': """
>>> from django import forms
>>> from django.forms.models import ModelForm
>>> from django.forms.models import ModelForm, model_to_dict
>>> from django.core.files.uploadedfile import SimpleUploadedFile
The bare bones, absolutely nothing custom, basic case.
@@ -793,6 +802,11 @@ ValidationError: [u'Select a valid choice. 4 is not one of the available choices
>>> ImprovedArticleWithParentLinkForm.base_fields.keys()
[]
>>> bw = BetterWriter(name=u'Joe Better')
>>> bw.save()
>>> sorted(model_to_dict(bw).keys())
['id', 'name', 'writer_ptr_id']
# PhoneNumberField ############################################################
>>> class PhoneNumberForm(ModelForm):