Started work on LocalizedMagicSlugField

This will be a superior version of LocalizedAutoSlugField, but one
that doesn't have concurrency issues and takes advantage of the
new UNIQUE CONSTRAINTs.
This commit is contained in:
Swen Kooij
2017-02-01 16:59:13 +02:00
parent 105c1e7b6b
commit e14350fbf3
8 changed files with 250 additions and 120 deletions

View File

@@ -1,6 +1,6 @@
from django.test import TestCase
from localized_fields import LocalizedValue
from localized_fields import LocalizedField, LocalizedValue
from .fake_model import get_fake_model
@@ -16,7 +16,12 @@ class LocalizedModelTestCase(TestCase):
super(LocalizedModelTestCase, cls).setUpClass()
cls.TestModel = get_fake_model()
cls.TestModel = get_fake_model(
'LocalizedModelTestCase',
{
'title': LocalizedField()
}
)
@classmethod
def test_defaults(cls):
@@ -46,4 +51,4 @@ class LocalizedModelTestCase(TestCase):
assert isinstance(obj.title, LocalizedValue)
assert obj.title.en == 'english_title'
assert obj.title.ro == 'romanian_title'
assert obj.title.nl == 'dutch_title'
assert obj.title.nl == 'dutch_title'