summaryrefslogtreecommitdiff
path: root/tests/regressiontests/model_fields/tests.py
diff options
context:
space:
mode:
authorLuke Plant <L.Plant.98@cantab.net>2011-03-10 01:21:59 +0000
committerLuke Plant <L.Plant.98@cantab.net>2011-03-10 01:21:59 +0000
commit2bb360c91c42ae7a23ad7330fc13d98a6d9efa5f (patch)
tree28fa3c7d97491ab2b689365af35e908acf8f6776 /tests/regressiontests/model_fields/tests.py
parentec7dd583f2b33aa9a575530fbec215426348fdf6 (diff)
[1.2.X] Fixed #15559 - distinct queries introduced by [15607] cause errors with some custom model fields
This patch just reverts [15607] until a more satisfying solution can be found. Refs #11707 Backport of [15791] from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15792 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/model_fields/tests.py')
-rw-r--r--tests/regressiontests/model_fields/tests.py19
1 files changed, 1 insertions, 18 deletions
diff --git a/tests/regressiontests/model_fields/tests.py b/tests/regressiontests/model_fields/tests.py
index f4bc63be7c..72a7d4d657 100644
--- a/tests/regressiontests/model_fields/tests.py
+++ b/tests/regressiontests/model_fields/tests.py
@@ -1,14 +1,13 @@
import datetime
import unittest
from decimal import Decimal
-import re
import django.test
from django import forms
from django.db import models
from django.core.exceptions import ValidationError
-from models import Foo, Bar, Baz, Whiz, BigD, BigS, Image, BigInt, Post, NullBooleanModel, BooleanModel
+from models import Foo, Bar, Whiz, BigD, BigS, Image, BigInt, Post, NullBooleanModel, BooleanModel
# If PIL available, do these tests.
if Image:
@@ -95,10 +94,6 @@ class DecimalFieldTests(django.test.TestCase):
# This should not crash. That counts as a win for our purposes.
Foo.objects.filter(d__gte=100000000000)
-class BazForm(forms.ModelForm):
- class Meta:
- model = Baz
-
class ForeignKeyTests(django.test.TestCase):
def test_callable_default(self):
"""Test the use of a lazy callable for ForeignKey.default"""
@@ -106,18 +101,6 @@ class ForeignKeyTests(django.test.TestCase):
b = Bar.objects.create(b="bcd")
self.assertEqual(b.a, a)
- def test_distinct_choice_limit(self):
- """Doesn't make sense to offer the same ForeignKey multiple times in a form"""
- a = Foo.objects.create(a='a', d=Decimal("-1"))
- b = Foo.objects.create(a='b', d=Decimal("1"))
- bar_a = Bar.objects.create(b='ah', a=a)
- bar_b = Bar.objects.create(b='aha', a=a)
- bar_b = Bar.objects.create(b='bla', a=b)
- form = BazForm()
- fk_field = str(form['foo'])
- self.assertEqual(len(re.findall(r'value="%d"' % b.pk, fk_field)), 0)
- self.assertEqual(len(re.findall(r'value="%d"' % a.pk, fk_field)), 1)
-
class DateTimeFieldTests(unittest.TestCase):
def test_datetimefield_to_python_usecs(self):
"""DateTimeField.to_python should support usecs"""