Another problem with django-multilingual

11 views
Skip to first unread message

Eugene Morozov

unread,
May 22, 2007, 11:44:01 AM5/22/07
to Django users
Hello,
I'm trying to use django-multilingual for multilingual site, instead
of reinventing the wheel. But in admin interface I get:
"Something's wrong with your database installation. Make sure the
appropriate database tables have been created, and make sure the
database is readable by the appropriate user." for every translatable
model. For example, I have a model for blog entry:

class Entry(models.Model):
author = models.ForeignKey(Author, related_name="entries")
blog = models.ForeignKey(Blog, related_name="entries")
pictures = models.ManyToManyField(Picture, blank=True,
related_name="entries")
comments_allowed = models.BooleanField(_("Comments allowed"))
posted = models.DateTimeField(_("Date posted"), auto_now_add=True)

class Translation(multilingual.Translation):
title = models.CharField(_("Title"), maxlength=250,
help_text=_("Title of the entry"))
slug = models.SlugField(prepopulate_from=("name",))
body = models.TextField(_("Body"))

As you see, it has both translatable and non-translatable fields. I'm
running Django-0.96 on python2.5. I use psycopg2 db adapter.
Eugene

Eugene Morozov

unread,
May 22, 2007, 3:28:42 PM5/22/07
to Django users
In addition to this issue, I'm getting SQL errors on attempts to save
multilingual objects, because of such invalid constructs:
LEFT JOIN blog_blogtranslation AS blog_blogtranslation_zh-cn ON
((blog_blogtranslation_zh-cn.master_id = blog_blog.id) AND
(blog_blogtranslation_zh-cn.language_id = 38))

Aliases must be quoted by django, but they aren't. I've tried to find
what causes this quoting error but gave up after two hours... Need to
get some sleep.

Did anyone attempted to use django-multilingual?
Eugene

marcin.k...@gmail.com

unread,
May 22, 2007, 4:06:45 PM5/22/07
to Django users
Hi Eugene,

On May 22, 5:44 pm, Eugene Morozov <eugene.moro...@gmail.com> wrote:
> I'm trying to use django-multilingual for multilingual site, instead
> of reinventing the wheel. But in admin interface I get:
> "Something's wrong with your database installation. Make sure the
> appropriate database tables have been created, and make sure the
> database is readable by the appropriate user." for every translatable
> model.

A knee-jerk question here is: did you remember to run syncdb after
creating the translatable models? If you did, try again and make sure
there were no validation errors.

> slug = models.SlugField(prepopulate_from=("name",))

The prepopulate_from parameter contains a nonexistant field name (you
probably wanted to use "title" instead), but apparently Django does
not validate it. I just pasted your Entry model into one of apps in
my testproject, added missing models (Author, Blog and Picture) and it
simply worked for me.

If syncdb does not help, then please try to create a minimal test app
for the problem and post it to django-multilingual bug tracker (http://
code.google.com/p/django-multilingual/).

-mk

marcin.k...@gmail.com

unread,
May 22, 2007, 5:53:09 PM5/22/07
to Django users
Due to some weirdness on google groups I did not see your second
message when replying to the first one. The SQL you posted was enough
to solve the problem.

On May 22, 9:28 pm, Eugene Morozov <eugene.moro...@gmail.com> wrote:
> In addition to this issue, I'm getting SQL errors on attempts to savemultilingualobjects, because of such invalid constructs:

It is the same issue: django-multilingual constructs incorrect table
names for language codes that contain a dash.

I just committed a fix for that.

> Aliases must be quoted by django, but they aren't. I've tried to find
> what causes this quoting error but gave up after two hours... Need to
> get some sleep.

They are not because this part of SQL is generated by D-M, not Django
core, in multilingual/query.py. I should probably fix it soon.

Thanks for trying out D-M and submitting the bug report,
-mk

Eugene Morozov

unread,
May 22, 2007, 6:45:17 PM5/22/07
to Django users
Hello,
Thank you for fixing the bug so quickly. But if you'll add
'i18n.multilingual' to the list of installed apps in the settings.py
in the example I've attached to #22, then "manage.py runserver" or
"manage.py syncdb" commands stop working with exception
"AttributeError: 'module' object has no attribute 'multilingual'"
Eugene

On 23 май, 00:06, "marcin.kaszyn...@gmail.com"

marcin.k...@gmail.com

unread,
May 22, 2007, 7:56:55 PM5/22/07
to Django users
On May 23, 12:45 am, Eugene Morozov <eugene.moro...@gmail.com> wrote:
> Thank you for fixing the bug so quickly. But if you'll add
> 'i18n.multilingual' to the list of installed apps in the settings.py
> in the example I've attached to #22, then "manage.py runserver" or
> "manage.py syncdb" commands stop working with exception
> "AttributeError: 'module' object has no attribute 'multilingual'"

Interesting. I have no idea why 'i18n.blog' works and
'i18n.multilingual' does not, but as a quick workaround you can put
'multilingual' instead of 'i18n.multilingual' in INSTALLED_APPS.

I see the same problem here, it looks like something is causing a
circular import. I will have to look into it later.

-mk

Reply all
Reply to author
Forward
0 new messages