GithubHelp home page GithubHelp logo

django-multilingual's Introduction

===================
Django Multilingual
===================

This is a library providing support for multilingual content in Django models. 

For installation instructions, see the file "INSTALL" in this directory; for
instructions on how to use this application, and on what it provides, see the
file "overview.rst" in the "docs/" directory or browse the whole documentation
already available in "docs/_build/html".

django-multilingual's People

django-multilingual's Issues

FieldDoesNotExist

class Title(models.Model):                                                

    class Translation(multilingual.Translation):                          

        title = models.CharField(maxlength=200)                           

    def __unicode__(self):                                                

        try:                                                              

            return self.title                                             

        except multilingual.TranslationDoesNotExist:                      

            return "-not-available-"                                      

    class Admin:                                                          

        fields = (                                                        

            (None, {'fields': ('title',)}),                               

        )

When i'm trying to add item in admin interface it eaises exception:
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py" in
_real_get_response
  81. response = callback(request, *callback_args, **callback_kwargs)
File
"/usr/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py"
in _checklogin
  55. return view_func(request, *args, **kwargs)
File "/usr/lib/python2.4/site-packages/django/views/decorators/cache.py" in
_wrapped_view_func
  39. response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/main.py"
in add_stage
  305. return render_change_form(model, manipulator, c, add=True)
File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/main.py"
in render_change_form
  200. field_sets = opts.admin.get_field_sets(opts)
File "/usr/lib/python2.4/site-packages/django/db/models/options.py" in
get_field_sets
  262. opts.get_field, fs_options['fields'], description))
File "/usr/lib/python2.4/site-packages/django/db/models/options.py" in __init__
  273. self.field_lines = [AdminFieldLine(field_locator_func, line_spec)
for line_spec in line_specs]
File "/usr/lib/python2.4/site-packages/django/db/models/options.py" in __init__
  293. self.fields = [field_locator_func(linespec)]
File "/usr/lib/python2.4/site-packages/django/db/models/options.py" in
get_field
  131. raise FieldDoesNotExist, '%s has no field named %r' %
(self.object_name, name)

  FieldDoesNotExist at /admin/activity/title/add/
  Title has no field named 'title'


django revision revision 6406
django-multilingual revision 61





Original issue reported on code.google.com by [email protected] on 22 Sep 2007 at 3:00

Filtering on translatable fields is limited

Take this model for example:

class News(models.Model):
    publication_date = models.DateTimeField('Publication',
default=datetime.datetime.now)

    class Translation(multilingual.Translation):
        published = models.BooleanField(blank=True)
        headline = models.CharField('Headline', max_length=255)
        body = models.TextField('Text')

I have LANGUAGES = (('en', 'English'), ('de', 'German')) and
DEFAULT_LANGUAGE=1 in my settings.py

Now suppose I want to filter on the published field. In english, the entry
is published but in german it isn't. If I use

News.objects.all().for_language('de').filter(published=True)

I would have expected, that the news entry would not be returned. I have to
call multilingual.set_default_language for this to work, which does not
seem too nice because this sets the default language value request-wide.

Thanks.

Original issue reported on code.google.com by [email protected] on 4 Apr 2008 at 8:22

prepopulate_from does not work in Translation subclass

What steps will reproduce the problem?
1.
definition in model.py of thow fields multilingual
 title = models.CharField(maxlength=250)
 slug  = models.SlugField(prepopulate_from=("title")) 
2.
in the admin page the slugfield no auto-populate with title field
3.

What is the expected output? What do you see instead?
the expected output is: auto-populate the slugField

What version of the product are you using? On what operating system?
the lastes svn django "pre-0.97" and the last svn multilingual
Ubuntu 7.04

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 18 Jul 2007 at 9:47

django-multilingual breaks ./manage.py shell_plus

What steps will reproduce the problem?
1. create a model that uses django-multilingual
2. run ./manage.py shell_plus

With a MenuItem model that has multilingual content, I get the following 
traceback when running 
./manage.py shell_plus:

From 'auth' autoloaded: Message, Group, User, Permission
From 'contenttypes' autoloaded: ContentType
From 'sessions' autoloaded: Session
From 'sites' autoloaded: Site
From 'flatpages' autoloaded: FlatPage
From 'admin' autoloaded: LogEntry
From 'markup' autoloaded: 
From 'thumbnail' autoloaded: 
From 'auction' autoloaded: Building, Image, Apartment
From 'gallery' autoloaded: Image, Group
From 'multilingual' autoloaded: 
From 'menu' autoloaded: MenuItem, MenuItemTranslation
Traceback (most recent call last):
  File "./manage.py", line 12, in <module>
    execute_manager(settings)
  File "/opt/local/lib/python2.5/site-packages/django/core/management/__init__.py", line 272, 
in execute_manager
    utility.execute()
  File "/opt/local/lib/python2.5/site-packages/django/core/management/__init__.py", line 219, 
in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/local/lib/python2.5/site-packages/django/core/management/base.py", line 72, in 
run_from_argv
    self.execute(*args, **options.__dict__)
  File "/opt/local/lib/python2.5/site-packages/django/core/management/base.py", line 86, in 
execute
    output = self.handle(*args, **options)
  File "/opt/local/lib/python2.5/site-packages/django/core/management/base.py", line 168, in 
handle
    return self.handle_noargs(**options)
  File "/opt/local/lib/python2.5/site-
packages/extensions/management/commands/shell_plus.py", line 64, in 
handle_noargs
    imported_objects[model.__name__] = getattr(__import__(app_mod.__name__, {}, {}, 
model.__name__), model.__name__)
AttributeError: 'module' object has no attribute 'MenuItemTranslation'

I'm using django-multilingual trunk rev. 92.

The ./manage.py shell_plus command tries to import magical models created by 
django-
multilingual but cannot find them because ithey do not exist in code.

Not sure if this is the bug of django-multilingual or django-command-extensions.

Original issue reported on code.google.com by eallik on 23 May 2008 at 2:15

Install multilingual apps error

when we use multilingual package to build serveral apps ,and install them
,there are some errors:
 1. we will install apps (dict, public.users, liveclass), "dict" is
multiligualed, the other  class is related to A, when we first install all
the apps sequentially, django return some errors such as :
"Error: Couldn't install apps, because there were errors in one or more models:
public.users: no such table: dict_data
liveclass: no such table: dict_data"

2. if we hide public.users and liveclass apps ,just install the "dict"
apps, then install the other apps , things will be ok.



Original issue reported on code.google.com by [email protected] on 18 May 2007 at 8:22

Newforms-admin - edit_inline problem

In newforms-admin 'edit_inline' doesn't work for multilinual models. There 
is also an issue with layout of multiple multilingual fields. 

See: http://groups.google.com/group/django-multilingual/browse_thread/
thread/adc55503fb9a0e02

Here I attach a patch that solves the edit_inline problem and probably 
also the layout problem.

Original issue reported on code.google.com by [email protected] on 6 Mar 2008 at 10:17

Attachments:

'prepopulated_fields' not supported

Steps will reproduce the problem:
1. Create a model with 'name' as a multilingual field (using class
Translation).

class Category(models.Model):
    system_name = models.SlugField(max_length=30)
    parent = models.ForeignKey('self', null=True, blank=True)

    class Translation(multilingual.Translation):
        name = models.CharField(max_length=30)

    def __unicode__(self):
        return self.name


2. Using the in admin model: prepopulated_fields = {'XXXXXX': ('name',)}

class CategoryAdmin(admin.ModelAdmin):
    prepopulated_fields = {"system_name": ("name",)}
admin.site.register(Category, CategoryAdmin)

It gives a beautiful ugly error message:
ImproperlyConfigured at /admin/items/category/
Error while importing URLconf 'lukes.urls':
`CategoryAdmin.prepopulated_fields['name'][0]` refers to field `name` that
is missing from model `Category`.

This is using the 1.0 pre-release version.

Original issue reported on code.google.com by [email protected] on 31 Jul 2008 at 6:32

TransBoundRelatedObject doesn't seem to apply admin/edit_inline_translations.html

What steps will reproduce the problem?
1. checkout Django from trunk
2. try and run test application from multilingual svn


What is the expected output? What do you see instead?

When I run the bundled test project after a checkout, it seems like the
specialized admin template isn't applied to the admin view when i want to
add a new Category. Instead it just get the normal edit_inline_stacked.html
template.

I have tried overriding the edit_inline_stacked.html template in
templates/admin/edit_inline_stacked.html by renaming
edit_inline_translations.html and it seems to work fine, although it is not
a solution.

If I somehow edit the:

  def template_name(self):
    return "admin/edit_inline_translations.html"

to say:

  def template_name(self):
    return "admin/edit_inline_another_template.html"

nothing happens and no error of not finding the template is shown. So
somehow it seems that the class is never used in:

edit_inline=TransBoundRelatedObject

or it might somehow be that my django-installation is broken and doesn't
allow the override?

I haven't been able to find any discussion on the issue on the net/groups,
so it seems to be either something new or a local error for my system.

What version of the product are you using? On what operating system?

django-trunk (v0.95.1) on a mac os x (10.4.9). Multilingual has been
checked out today (21.03.2007).

Original issue reported on code.google.com by [email protected] on 21 Mar 2007 at 6:42

Create a better admin interface

Current implementation of translation editor always tries to save all the
translations.  It should be possible to omit some translations, ie. with a
checkbox.

Original issue reported on code.google.com by [email protected] on 5 Feb 2007 at 5:08

Translate language names from settings.LANGUAGES

The best-practice for translatable language name in settings.py is to use a
dummy gettext function around them and translating them when needed. This
is because settings.py can not import the translation module (import cycle).

Example:
_ = lambda s: s
LANGUAGES = (
    ('en', _(u'English')),
    ('nl', _(u'Nederlands')),
)

This means that language names need to be translated before being passed to
a template. Extraneous translation probably does no harm for people who do
not use translatable name, so I would suggest applying the attached patch
(or something similar).

Original issue reported on code.google.com by [email protected] on 7 Jun 2008 at 12:54

Attachments:

Configurable 'translation' suffix

It would be good, to have possibility to change suffix 'translation' of
table and 'Translation' of model class in settings.

Reasons:
1. django derives table name from model name e.g. ContentType ->
content_type, so translation table for model HousePet should be named
house_pet_translation instead of house_pettranslation.
2. translation is too long, I would prefer something like _lang, but it is
personal preference, so that is the reason way (IMHO) it should be
configurable.

Original issue reported on code.google.com by [email protected] on 26 Apr 2007 at 7:35

Multilingual stop working after revision 78

What steps will reproduce the problem?
1. svn update from 78 to 79 or 80, or... 82

What is the expected output? What do you see instead?
The functional site with django multilingual enabled, stop working whit a
compiler error that tell that "no module multilingual exist"
With rev 78 all works fine.

What version of the product are you using? On what operating system?
Debian Etch on latest django(rev 6710)




Original issue reported on code.google.com by [email protected] on 24 Nov 2007 at 10:34

Invalid SQL generated for multilingual models

Test project is attached.

Here's what happens in shell:
Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:12:50)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from i18n.blog.models import Blog
>>> from django.contrib.sites.models import Site
>>> Site.objects.all()
[<Site: example.com>]
>>> s = Site.objects.get(pk=1)
>>> b = Blog(description_en='blah', site=s)
>>> b
<Blog: example.com>
>>> b.save()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/var/lib/python-support/python2.5/django/db/models/base.py", line
250, in save
    dispatcher.send(signal=signals.post_save, sender=self.__class__,
instance=self)
  File "/var/lib/python-support/python2.5/django/dispatch/dispatcher.py",
line 360, in send
    **named
  File "/var/lib/python-support/python2.5/django/dispatch/robustapply.py",
line 47, in robustApply
    return receiver(*arguments, **named)
  File "/home/jmv/tmp/i18n/multilingual/translation.py", line 38, in
translation_save_translated_fields
    translation.save()
  File "/var/lib/python-support/python2.5/django/db/models/base.py", line
197, in save
    dispatcher.send(signal=signals.pre_save, sender=self.__class__,
instance=self)
  File "/var/lib/python-support/python2.5/django/dispatch/dispatcher.py",
line 360, in send
    **named
  File "/var/lib/python-support/python2.5/django/dispatch/robustapply.py",
line 47, in robustApply
    return receiver(*arguments, **named)
  File "/home/jmv/tmp/i18n/multilingual/translation.py", line 51, in
translation_overwrite_previous
    qs =
qs.filter(master=instance.master).filter(language_id=instance.language_id)
  File
"/var/lib/python-support/python2.5/django/db/models/fields/related.py",
line 171, in __get__
    rel_obj = self.field.rel.to._default_manager.get(**params)
  File "/var/lib/python-support/python2.5/django/db/models/manager.py",
line 73, in get
    return self.get_query_set().get(*args, **kwargs)
  File "/var/lib/python-support/python2.5/django/db/models/query.py", line
250, in get
    obj_list = list(clone)
  File "/var/lib/python-support/python2.5/django/db/models/query.py", line
108, in __iter__
    return iter(self._get_data())
  File "/var/lib/python-support/python2.5/django/db/models/query.py", line
470, in _get_data
    self._result_cache = list(self.iterator())
  File "/home/jmv/tmp/i18n/multilingual/query.py", line 139, in iterator
    for obj in super(MultilingualModelQuerySet, self).iterator():
  File "/var/lib/python-support/python2.5/django/db/models/query.py", line
183, in iterator
    cursor.execute("SELECT " + (self._distinct and "DISTINCT " or "") +
",".join(select) + sql, params)
  File "/var/lib/python-support/python2.5/django/db/backends/util.py", line
12, in execute
    return self.cursor.execute(sql, params)
ProgrammingError: ошибка синтаксиса в или рядом "-"
LINE 1: ...IN blog_blogtranslation AS blog_blogtranslation_pt-br ON ((b...
                                                             ^

>>>

Original issue reported on code.google.com by [email protected] on 22 May 2007 at 9:01

Attachments:

Problems with select_related in QuerySet

>>> g = Gallery.objects.get(id=2)
>>> g.title
'Test polski'
>>> g.title_en
'English Test'
>>> g = Gallery.objects.select_related(depth=1).get(id=2)
>>> g.title
1
>>> g.title_en
1

As you see, something weird happens when I use select_related. I don't have
an idea where the one comes from, since it is not any of IDs in gallery
table nor in gallerytranslation table.
It happens with both Django 0.96 and current svn snapshot. I tested it on
the latest revision of django-multilingual.

Original issue reported on code.google.com by [email protected] on 12 Apr 2007 at 10:54

Admin list view: column headers are broken for translatable fields

This is caused by d-m using Python properties to provide
access to translatable fields.  Django expects columns to
be defined by fields or functions that have short_description
property on them, but there is no way to attach such
a property to a property.

The workaround for the time being is to replace:

class Admin:
   list_display = ('translatable_field', 'some_other_field')

with:

class Admin:
   list_display = ('get_translatable_field', 'some_other_field')

This will cause the right header to show up.


Original issue reported on code.google.com by [email protected] on 28 Jan 2007 at 10:49

IndexError when trying to add an object from the admin page

What steps will reproduce the problem?
1. Create a testproj and testapp, and define a simple multilingual model:

class Category(models.Model):
    creation_date = models.DateTimeField(auto_now_add=True)

    class Translation(multilingual.Translation):
        name = models.CharField(maxlength=80)

    class Admin:
        pass

    def __unicode__(self):
        return self.name

2. Log in to the admin site, and try adding a category object

What is the expected output? What do you see instead?
A multilingual form to add the said object.

Instead it shows an IndexError:

IndexError at /admin/testapp/category/add/
list index out of range

Exception Location:  
C:\Python25\lib\site-packages\django\contrib\admin\views\main.py in
render_change_form, line 196

What version of the product are you using? On what operating system?
Django 096.1, Python2.5, django-multilingual.trunk, WindowsXP and MacOSX 

Original issue reported on code.google.com by [email protected] on 8 Nov 2007 at 9:18

``order_with_respect_to``raises AttributeError

What steps will reproduce the problem?
1. Model definition:
class Post(models.Model):
    thread = ForeignKey('Thread')
    ...

    class Meta:
        order_with_respect_to = 'thread'
    ...
2. $ python manage.py validate
Raises (shortened)
File "/share/Eigene
Webs/Workspace/pyhosts/pyewe/../pyewe/boards/models.py", line 277, in <module>
    class Post(models.Model):
  File "/share/Eigene
Webs/Workspace/pyhosts/contrib/multilingual/translation.py", line 345, in
multilingual_modelbase_new
    return _old_new(cls, name, bases, attrs)
  File "/usr/lib/python2.5/site-packages/django/db/models/base.py", line
75, in __new__
    new_class._prepare()
  File "/usr/lib/python2.5/site-packages/django/db/models/base.py", line
101, in _prepare
    setattr(opts.order_with_respect_to.rel.to, 'get_%s_order' %
cls.__name__.lower(), curry(method_get_order, cls))
AttributeError: 'str' object has no attribute 'get_post_order'


What is the expected output? What do you see instead?
As this Model doesn't even have a Tranlation it took me while to figure out
the problem. I wanted an OK from the validation.

What versions of django and multilingual are you using? On what operating
system?
Both latest svn

Please provide any additional information below.
Hope you fix that soon. (At least models without ANY translaytion shouldn't
be touched! :P)

Original issue reported on code.google.com by [email protected] on 15 May 2008 at 12:05

A translatable column with UNIQUE should be unique per language, not globally

What should happen:

>>> set_default_language('pl')
>>> g = Gallery.objects.create(id=2, title_pl='Test polski',
title_en='English Test')
>>> g.title
'Test polski'
>>> g.title_en
'English Test'
>>> g.save()
>>> g.title_en = 'Test polski'
>>> g.save()
>>> try:
...     g = Gallery.objects.create(id=3, title_pl='Test polski')
... except: print "ERROR"
... 
ERROR
>>> 

What happens instead:

Crash after 
>>> title_en = 'Test polski'

Original issue reported on code.google.com by [email protected] on 10 Nov 2007 at 4:16

Attachments:

Add an easy way to tie the default language to LANGUAGE_CODE

For reproducing this, I made simple app using testproject (attached).

To author: You said about set_default_language:
It is usually called from a middleware before processing a request. It does
not change the language globally, as that value is local to a thread.

So I tried it,using standard django set_language view plus I added
set_default_language call to that view.

And now the problem:
1. Using django server (./manage.py runserver) it works for one client
(LANGUAGE_CODE and DEFAULT_LANGUAGE_CODE are switching OK), but when I open
another browser and change a language, DEFAULT_LANGUAGE_CODE is change in
first browser as well - so in first browser gettext text(which is using
LANGUAGE_CODE) is in right language, but django-multilingual text(which is
using DEFAULT_LANGUAGE_CODE) is in language which selected another client.
Django server is only for test purpose, so it doesn't matter so much, but
on the production server:

2. Using apache & mod_python, it doesn't work at all -
DEFAULT_LANGUAGE_CODE is still as in the settings.py file of project. 
(it maybe get changed for the while when in set_language view, but after
redirect back to original view, it will not remember it (I'm only guessing)).


Using SVN version.

To run testproject:
Just create database and than create one category in it - then go to
http://127.0.0.1:8000/lang_test/ and try switching languages.

On apache, I added name testproject.localhost to /etc/hosts after 127.0.0.1
      localhost and used this in apache configuration:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName testproject.localhost


    SetHandler python-program
    PythonPath "['/home/glin/programming/workspace/',
'/home/glin/programming/workspace/testproject/'] + sys.path"
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE testproject.settings
    PythonDebug On

</VirtualHost>


Conclusion:
IMHO language of models should depend on LANGUAGE_CODE as everything in
django. If you have reason for DEFAULT_LANGUAGE_CODE, please fix this bug
and create some view for switching language (something like I did in
attached project).


Original issue reported on code.google.com by [email protected] on 7 May 2007 at 12:02

Attachments:

Make it easier to build list_display and search_fields

Right now, when you want to have all the translated versions of a column in
list_display and search_fields you need to explicitely specify them, ie:

    class Admin:
        list_display = ('id', 'name_pl', 'name_en')
        search_fields = ('name_pl', 'name_en')

It makes the code dependent on the list of languages in settings.py.  It
would be better to be able to do something like this:

    class Admin:
        list_display = ('id',) + Translation.all_versions('name')
        search_fields = Translation.all_versions('name')



Original issue reported on code.google.com by [email protected] on 5 Feb 2007 at 5:05

Multilingual flatpages

Hello,
I am discovering django multilingual and I just love it so far. My first
use case for it is to build a multilingual flatpages webapp.

I guess this is not very original. :-) I am wondering if it would not be a
could idea to have it included in your application a showcase.

So far I have done something very simple which is highly inspired from
flatpages.

I you like the idea I can start improving this application and start
writting some documentation.

Congratulation for this great app.
Thank you


Original issue reported on code.google.com by [email protected] on 20 Nov 2007 at 11:54

Surround fields for right-to-left languages with css

Translated fields for languages that are written right-to-left (i.e.
Arabic, Farsi, Hebrew) should have CSS style "direction: rtl; text-align:
right" applied to them. This is possible by 1) adding language_bidi
function, 2) adding language_bidi templatetag and 3) surrounding the field
by a span tag that contains a CSS style attribute. Conversely, because the
admin interface language might be rtl, fields in other languages should be
explicitely marked ltr.

The attached patch implements this change. The implementation in the
template is a bit ugly, but works.

Original issue reported on code.google.com by [email protected] on 7 Jun 2008 at 12:46

Attachments:

Store translation data directly in master object's __dict__

Data for normal fields is kept in __dict__ of the model instance.  It might
be a good idea to do the same with translated content.  For example:

    class Category(models.Model):
        class Translation(multilingual.Translation):
            name = models.CharField(...)

    c = Category()

Currently c.name, c.name_en and c.name_pl are handled by properties that
keep the data in c._translation_cache as a dictionary of
CategoryTranslation instances.  The change would be to keep name_en,
name_pl and all the localized versions directly in c.__dict__, using the
CategoryTranslation model only when saving or loading the data.  It should
make a lot of things simpler AND faster.

Original issue reported on code.google.com by [email protected] on 12 Feb 2007 at 10:49

Please include example fixtures

Including fixtures with your articles/ test app would make for a more
comprehensive test since it would show that it works with Django fixtures,
it would also make for nicer demo since your sample app would already be
populated.

I've attached a simple initial_data.xml that you can put into
articles/fixtures but you'll probably want to dumpdata your more
comprehensive category example.

regards,
jure

Original issue reported on code.google.com by [email protected] on 4 May 2007 at 9:55

Attachments:

Problem with models in separated files

Problem occures when using approach, where I have more models in app and
each model has its own file, something like this:
cms/
    __init__.py          # Empty file
    models/
        __init__.py      # Contains "from category import Cantegory; from
page import Page"
        category.py      # Contains Category model
        page.py          # Contains Page model

With this quite usual structure, Translation fields are not found and
sqlall output behaves as there is no Translation fields at all.

Using SVN version on gentoo linux.



Original issue reported on code.google.com by [email protected] on 24 Apr 2007 at 11:59

Model validation error with inheried models

Hi !

I found a problème while using django-multilingual and inheried models
together.

This is the interesting part of the settings (I didn't touch anything else):

========================================

LANGUAGES = (
    ('en', 'English'),
    ('pl', 'Polish'),
)


DEFAULT_LANGUAGE = 1


 INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'multilingual',
    'dm',
)
========================================

Here is the model:

========================================
from django.db import models

import multilingual


class Parent( models.Model ):
    class Translation(multilingual.Translation):
        field1 = models.SlugField( editable=False )

class Child( Parent ):
    class Translation(multilingual.Translation):
        field2 = models.SlugField( editable=False )
=============================================

And this what I got when I launch manage.py syncdb:

================================================
Error: One or more models did not validate:
dm.childtranslation: Accessor for field 'master' clashes with related field
'Child.translations'. Add a related_name argument to the definition for
'master'.
dm.childtranslation: Reverse query name for field 'master' clashes with
related field 'Child.translations'. Add a related_name argument to the
definition for 'master'.
=================================================

This is not a db related problem (I got the same error with sqlite and
postgresql)...

Some ideas ?


Original issue reported on code.google.com by [email protected] on 6 Aug 2008 at 2:46

order_with_respect_to not working

From the discussion group (Piotr Majewski):

I keep getting strange errors: 
'str' object has no attribute 'get_category_order' 

with model:

class Category(models.Model):
    parent = models.ForeignKey('self', blank=True,
null=True,related_name='children')
    class Meta:
        verbose_name_plural=_("Categories")
        verbose_name=_("Category")
        ordering=['order',]
        order_with_respect_to = 'parent'
    class Translation(multilingual.Translation):
        name = models.CharField(max_length=250,verbose_name=_("Name"))
        title =
models.CharField(max_length=250,verbose_name=_("Title"), blank=True,
null=True)
        keywords =
models.CharField(max_length=250,verbose_name=_("Keywords"),
blank=True, null=True)
        meta = models.CharField(max_length=250,verbose_name=_("Meta"),
blank=True, null=True)
        description = models.TextField(verbose_name=_("Description"),
blank=True, null=True)
        slug = models.SlugField(verbose_name=_("Slug"), blank=True,
null=True)
        order = models.PositiveSmallIntegerField(default=0,
verbose_name=_("Order"), blank=True, null=True)
        enabled =
models.BooleanField(default=False,verbose_name=_("Enabled"))
    def __unicode__(self):
        return self.name

class Product(models.Model):
    categories = models.ManyToManyField(Category, blank=True,
null=True,related_name='products')
    class Meta:
        verbose_name_plural=_("Products")
        verbose_name=_("Product")
    class Translation(multilingual.Translation):
        name = models.CharField(max_length=250,verbose_name=_("Name"))
        title =
models.CharField(max_length=250,verbose_name=_("Title"), blank=True,
null=True)
        keywords =
models.CharField(max_length=250,verbose_name=_("Keywords"),
blank=True, null=True)
        meta = models.CharField(max_length=250,verbose_name=_("Meta"),
blank=True, null=True)
        description = models.TextField(verbose_name=_("Description"),
blank=True, null=True)
        desc = models.TextField(verbose_name=_("Short Description"),
blank=True, null=True)
        slug = models.SlugField(verbose_name=_("Slug"), blank=True,
null=True)
        order = models.PositiveSmallIntegerField(default=0,
verbose_name=_("Order"), blank=True, null=True)
        enabled =
models.BooleanField(default=False,verbose_name=_("Enabled"))
    def __unicode__(self):
        return self.name 

Original issue reported on code.google.com by info%[email protected] on 5 Jul 2008 at 2:13

Patch to make django-multilingual work with newforms-admin

Patch makes it possible to use django-multilingual with newforms-admin 
branch.

It works for testproject but thats all. It's neither tested, verified nor 
validated by anyone so use it on your own risk!

To apply the patch just copy the attached file into 'multilinual' folder 
of django-multilingual application and run:
patch -p0 < newforms-admin-patch.diff

Original issue reported on code.google.com by [email protected] on 17 Dec 2007 at 1:37

Attachments:

test issue

Just testing the notification settings, this is not an actual issue.

Original issue reported on code.google.com by [email protected] on 10 Jun 2008 at 12:11

Add MoreInfo status to issue tracker

Marcin, please add a MoreInfo status label to the issue tracker. (I think
only you can do that.)

Original issue reported on code.google.com by joost.cassee on 10 Jun 2008 at 1:41

Update for current Django

Attached is a small patch that gets django-multilingual compatible with the
current Django trunk:

* Allow it to work with the order_by-for-related-tables patch (Django
ticket-2076)
* get_where_clause() has a fifth parameter
* Import quote_name() correctly

I added compatibility code so that it still works with older versions.

Original issue reported on code.google.com by [email protected] on 9 Nov 2007 at 3:17

Attachments:

Multilingual package gets confused if it's not on the project base

If I have a custom project folder organization, multilingual package gets
confused. My example, I have 3 sites and a lib directory with applications
for all 3 sites:

project_root/
project_root/site1/
project_root/site1/settings.py
project_root/site2/
project_root/site2/settings.py
project_root/lib/test/
project_root/lib/test/models.py

I've configured the path properly to be able to import packages directly
from lib. Without translation it's working fully functional and I can use
the same set o applications to each sites and have a settings file per site.

If I define my model as:

class Test(models.Test):
   value = models.IntegerField()
   class Translation(multilingual.Translation):
      name = models.CharField()

The table is created without problems (and it seems to be ok, with
language_id and master_id fields on it), but when I do an insert or a
select it doesn't work. The error is bellow:

  File "/.../django/db/models/fields/related.py", line 171, in __get__
  File "/.../django/db/models/manager.py", line 73, in get
  File "/.../django/db/models/query.py", line 250, in get
  File "/.../django/db/models/query.py", line 108, in __iter__
  File "/.../django/db/models/query.py", line 470, in _get_data
  File "/.../project_root/multilingual/query.py", line 139, in iterator
    for obj in super(MultilingualModelQuerySet, self).iterator():
  File "/.../django/db/models/query.py", line 183, in iterator
  File "/.../django/db/backends/util.py", line 12, in execute
  File "/.../django/db/backends/sqlite3/base.py", line 93, in execute
OperationalError: no such column: teste_testetranslation_es.master_id

The admin interface isn't loaded too. The testproject get from trunk works
without problem. The problem occours on postgresql and sqlite3.

I try but I couldn't find the problem (I'm very tired now to understand
anything :D), I will take a look tomorrow, but I think a good idea is to
prepare the multilingual application to be on django.contrib.

I can make a small simulation of this problem if you think usefull.
Thanks for your great work!

Original issue reported on code.google.com by [email protected] on 27 Apr 2007 at 12:09

Update with QuerySet Refactor Django branch

Multilingual does not work with queryset-refactor branch, which was merged
into django trunk last week.

Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_manager(settings)
  File
"/home/users/m/sources/django-trunk/django/core/management/__init__.py",
line 272, in execute_manager
    utility.execute()
  File
"/home/users/m/sources/django-trunk/django/core/management/__init__.py",
line 219, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/users/m/sources/django-trunk/django/core/management/base.py",
line 72, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/users/m/sources/django-trunk/django/core/management/base.py",
line 81, in execute
    translation.activate('en-us')
  File
"/home/users/m/sources/django-trunk/django/utils/translation/__init__.py",
line 73, in activate
    return real_activate(language)
  File
"/home/users/m/sources/django-trunk/django/utils/translation/__init__.py",
line 43, in delayed_loader
    return g['real_%s' % caller](*args, **kwargs)
  File
"/home/users/m/sources/django-trunk/django/utils/translation/trans_real.py",
line 211, in activate
    _active[currentThread()] = translation(language)
  File
"/home/users/m/sources/django-trunk/django/utils/translation/trans_real.py",
line 200, in translation
    default_translation = _fetch(settings.LANGUAGE_CODE)
  File
"/home/users/m/sources/django-trunk/django/utils/translation/trans_real.py",
line 185, in _fetch
    app = __import__(appname, {}, {}, [])
  File
"/home/users/m/sources/django-multilingual-trunk/multilingual/__init__.py",
line 5, in <module>
    from multilingual import models
  File
"/home/users/m/sources/django-multilingual-trunk/multilingual/models.py",
line 16, in <module>
    from translation import install_translation_library
  File
"/home/users/m/sources/django-multilingual-trunk/multilingual/translation.py",
line 16, in <module>
    from multilingual import manager
  File
"/home/users/m/sources/django-multilingual-trunk/multilingual/manager.py",
line 2, in <module>
    from multilingual.query import MultilingualModelQuerySet,
QAddTranslationData
  File
"/home/users/m/sources/django-multilingual-trunk/multilingual/query.py",
line 11, in <module>
    from django.db.models.query import QuerySet, get_where_clause
ImportError: cannot import name get_where_clause


Do you plan to update multilingual with new django code?

Original issue reported on code.google.com by [email protected] on 28 Apr 2008 at 8:54

Make ordering and filtering work in QuerySet methods

Make ordering and filtering work in QuerySet methods (probably by
creating a new QuerySet subclass in MultilingualModelManager), so
that order_by('name') works like order_by('name_en') or
order_by('name_pl') depending on the default language; same goes
for filter(name__like='asd') and similar operations.

Original issue reported on code.google.com by [email protected] on 26 Jan 2007 at 12:23

Error in multilingual after "python manage.py syncdb"

Django from svn: rev 7003
Multilingual from svn: rev 82

All the site and the admin site works well.
The python path is correctly bind to trunk/.

When I try to sync the db with: python manage.py syncdb I have the
following error:

Traceback (most recent call last):
  File "manage.py", line 11, in ?
    execute_manager(settings)
  File
"/usr/lib/python2.4/site-packages/django/core/management/__init__.py", line
272, in execute_manager
    utility.execute()
  File
"/usr/lib/python2.4/site-packages/django/core/management/__init__.py", line
219, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.4/site-packages/django/core/management/base.py",
line 72, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.4/site-packages/django/core/management/base.py",
line 81, in execute
    translation.activate('en-us')
  File
"/usr/lib/python2.4/site-packages/django/utils/translation/__init__.py",
line 73, in activate
    return real_activate(language)
  File
"/usr/lib/python2.4/site-packages/django/utils/translation/__init__.py",
line 43, in delayed_loader
    return g['real_%s' % caller](*args, **kwargs)
  File
"/usr/lib/python2.4/site-packages/django/utils/translation/trans_real.py",
line 209, in activate
    _active[currentThread()] = translation(language)
  File
"/usr/lib/python2.4/site-packages/django/utils/translation/trans_real.py",
line 198, in translation
    default_translation = _fetch(settings.LANGUAGE_CODE)
  File
"/usr/lib/python2.4/site-packages/django/utils/translation/trans_real.py",
line 183, in _fetch
    app = __import__(appname, {}, {}, [])
ImportError: No module named multilingual

I don't know what to try to solve the problem.

Original issue reported on code.google.com by [email protected] on 7 Jan 2008 at 1:36

Problem loading fixtures

Steps will reproduce the problem:

1. Adding several objects with his translations
2. Do a ./manage.py dumpdata for this contents. Problem appears when
translations objects are located above masters one (it depends of models.py)
3. Do a ./manage.py reset for deleting all objects you have created.
3. Do a ./manage.py loaddata for restoring this objects from fixtures.

Error:

Problem installing fixture 'fooapp/fixtures/initial_data.xml': FooModel
matching query does not exist.

Django solves right all references because it turn commit management off
for fixtures loading. The problem is in django-multilingual signal receiver
named translation_overwrite_previous.

I've attached a patch that solves the problem. 

Original issue reported on code.google.com by [email protected] on 20 Apr 2008 at 6:01

Attachments:

Separate admin options for newforms-admin into admin.py

The file models.py contains the newforms-admin admin options. The comment
notices that this code should be in admin.py but the author does not know
how to make sure the module is loaded.

I would suggest added the following line to __init__.py:
from multilingual import admin

This seems to be the common way of loading admin modules.

Original issue reported on code.google.com by [email protected] on 3 Jun 2008 at 5:01

Insert element from admin interface error

What steps will reproduce the problem?
1.
class TipoEsercizio(models.Model):

  stuff = models.IntegerField()

  class Translation(multilingual.Translation):    
    nome = models.CharField( maxlength = 30 )
    descrizione = models.CharField( maxlength = 100, null = True, blank =
True )

  def __unicode__(self):
    return self.nome

  class Admin: pass
2. syncdb is all ok
3. from the admin interface try to insert a TipoEsercizio row but the error
below is displayed.

What is the expected output? What do you see instead?
The expected output is the succeful of the insert operation but i have this
error instead:

TemplateSyntaxError at /admin/installazioni/tipoesercizio/add/
'multilingual_tags' is not a valid tag library: Could not load template
library from django.templatetags.multilingual_tags, No module named
multilingual.languages

What version of the product are you using? On what operating system?

svn (django and multilingual with python 2.4.4 on debian etch)

Please provide any additional information below.

What is the procedure to install django-multilingual ?
The problem seems to be only in the admin interface.

Original issue reported on code.google.com by [email protected] on 28 Aug 2007 at 11:06

Automatic change view in admin is broken for some objects

The inline editor of translations does not work reliably for objects
created outside of admin.  This is caused by the assumption that
translations ordered by their 'id' fields contain translations in
the order defined by the LANGUAGES list.

Current inline editor is a hack and needs to be rebuilt soon.

Original issue reported on code.google.com by [email protected] on 26 Jan 2007 at 1:10

Admin view for models without non-translatable fields

1. If I create a model without non translatable fields, like:
class Option(models.Model):
    #dummy = models.BooleanField()
    class Translation(multilingual.Translation):
        name = models.CharField(max_length=30)

Instead of just showing the translatable names it raises an IndexError in:

first_form_field_id =
bound_field_sets[0].bound_field_lines[0].bound_fields[0].form_fields[0].get_id()
;


django and multilingual from the svn's.

For now I am using the dummy boolean field, for me this could be fixed
after the admin is rewritten in newforms (although I'm not sure if that
part is being changed)

I guess this only affects the admin view, if i mark the dummy
editable=False it still breaks. Haven't tried it with newforms admin.

Other fix could be writing Your own admin view for something like that.

I'm using it to display product features in a Manytomany relationship to
the product in case anyone wonders. When it works maybe it'll be a good
idea to add something along those lines to the testproject?

Original issue reported on code.google.com by grzesiof on 26 Dec 2007 at 12:26

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.