def testDelayedCreation(self): obj = Foo() obj.name = 'Foo' obj.price = 10 translation.activate('fr') obj.name = 'FooFr' obj.save() translation.activate('en') obj = Foo.objects.get(pk=obj.pk) self.assertEquals(obj.name, 'Foo') self.assertEquals(obj.price, 10) translation.activate('fr') self.assertEquals(obj.name, 'FooFr') self.assertEquals(obj.price, 10)
def testDelayedCreation(self): obj = Foo() obj.name = 'Foo' obj.price = 10 obj.save() obj2 = Foo.objects.get(pk=obj.pk) self.assertEquals(obj2.name, 'Foo') self.assertEquals(obj2.price , 10)
def testCreateTranslationWithoutSaving(self): obj = Foo() obj.name = 'Foo' obj.price = 10 try: obj2 = obj.create_translation(name='Foo2', language='fr') except InvalidActionError, e: self.assertEquals(unicode(e), _('Cannot create a translation of an unsaved object.') )