django-modeltranslation icon indicating copy to clipboard operation
django-modeltranslation copied to clipboard

Doesn't create objects model with field_??

Open gagaga67 opened this issue 10 years ago • 2 comments

I can't create object with title_en and etc in my custom script. When i run blog.objects.create(title=title, author = user) in db title_en is NULL. And blog.objects.create(title_en=title, author = user) get error TypeError: 'title_en' is an invalid keyword argument for this function. Create in admin form is ok. But need created many blogs. How i can do this without forms?

P. S. django = 1.8, modeltranslation = 0.9.1

gagaga67 avatar Jun 07 '15 18:06 gagaga67

don't you have to use: blog.objects.populate(True).create(title=title, author = user) ?

devlounge avatar Jun 16 '15 07:06 devlounge

TypeError: 'title_en' sounds like modeltranslation hasn't been triggered (imported). How is your script run? Does it perform Django setup(), and is modeltranslation in INSTALLED_APPS? Moreover, is English an active language in script context?

zlorf avatar Sep 26 '15 22:09 zlorf