开发者

error in admin page when editing using django-multilingual-ng on django 1.3

am trying to switch my application to use multilingual-ng, unfortunutely though, there is very little documentation and FAQ's online. I hope someone would be able to tell what is going on with my practice,

following is my model

class Main(models.Model):
    """ Main Class for all categories """
    slug       = models.SlugField()
    is_active  = models.BooleanField(default=True)
    site       = models.ForeignKey(Site)
    parent     = models.ForeignKey('self', blank=True, null=True)

    class Translation(TranslationModel):
        title               = models.CharField(max_length=100)
        label               = models.CharField(max_length=100, blank=True, null=True)
        description         = models.TextField(blank=True, null=True)
        disclaimer          = models.TextField(blank=True, null=True)
    class Meta:
        unique_together = (("slug", "parent"))

    def __unicode__(self):
        return self.title if self.title is not None else _("No translation")

and following is my admin.py

class MainAdmin(MultilingualModelAdmin):
    ''' Multilingual interface for Main category '''

class ListAdmin(MultilingualModelAdmin):
    ''' Multilingual interface for Main category '''



admin.site.register(Main, MainAdmin)
admin.site.register(List, ListAdmin)

When I access my admin panel, I can see the model, list of items, add new items but when I try to edit an existing item or delete one I get the followng error

  Environment:


Request Method: GET
Request URL: http://mazban.com/admin/category/main/1/

Django Version: 1.3
Python Version: 2.6.1
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.admindocs',
 'compressor',
 'django.contrib.gis',
 'multilingual',
 'mazban.lib.apps.core',
 'mazban.lib.apps.gis',
 'mazban.apps.global',
 'mazban.apps.listing',
 'mazban.apps.listing.post',
 'mazban.apps.listing.home',
 'mazban.apps.listing.engine',
 'mazban.apps.listing.category']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'mazban.lib.MiddleWare.custom.RequestIsMobile')


Traceback:
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/django/contrib/admin/options.py" in wrapper
  307.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/django/utils/decorators.py" in _wrapped_view
  93.                     response = view_func(request, *args, **kwargs)
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  79.         response = view_func(request, *args, **kwargs)
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/django/contrib/admin/sites.py" in inner
  197.             return view(request, *args, **kwargs)
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/multilingual/admin.py" in wrapped
  31.         resp = func(cls, request, *args, **kwargs)
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/multilingual/admin.py" in change_view
  277.         return super(MultilingualModelAdmin, self).change_view(*args, **kwargs)
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/django/utils/decorators.py" in _wrapper
  28.             return bound_func(*args, **kwargs)
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/django/utils/decorators.py" in _wrapped_view
  93.                     response = view_func(request, *args, **kwargs)
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/django/utils/decorators.py" in bound_func
  24.                 return func(self, *args2, **kwargs2)
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/django/db/transaction.py" in inner
  217.                 res = func(*args, **kwargs)
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/django/contrib/admin/options.py" in change_view
  947.         obj = self.get_object(request, unquote(object_id))
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/django/contrib/admin/options.py" in get_object
  451.             return queryset.get(pk=object_id)
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/django/db/models/query.py" in get
  341.         clone = self.filter(*args, **kwargs)
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/django/db/models/query.py" in filter
  550.         return self._filter_or_exclude(False, *args, **kwargs)
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/django/db/models/query.py" in _filter_or_exclude
  568.             clone.query.add_q(Q(*args, **kwargs))
File "/users/mo/Projects/python-envs/mazban/lib/python2.6/site-packages/django/db/models/sql/query.py" in add_q
  1172.                             can_reuse=used_aliases, force_having=for开发者_如何学Cce_having)

Exception Type: TypeError at /admin/category/main/1/
Exception Value: add_filter() got an unexpected keyword argument 'force_having'


Don't use django-multilingual-ng, as it is not supported anymore and will bring you many headaches. The author of the django-multilingual-ng started a new promising project, named django-nani. It should be reliable and Django 1.3 compatible.

As for me, this problem didn't show on Django 1.2.4, so you might want to move back to that version, once you go through the Django 1.2.5 release notes.


I installed from latest revision and the error disapeared:

$ pip install git+https://github.com/ojii/django-multilingual-ng.git

Although the error is gone using this release, it still says it it unsupported. I am heavily inclined to roll back to Django 1.2.4, but I am still trying to figure this out.

As mentioned, the django-nani project is promising, but it is still in alpha stages. I couldn't find a way to work with any type of model relationship as of today's revision. They will be working on it soon.


I've got the same problem, upgrading from 1.2.4 to the new security releases in 1.2.7. Ng is already in use and can't be swapped out, even though support for it has been dropped. Just the world we live in. I can't find any documentation on force_havings role in the django query system.

Glad they're working on a new system though. If anyone has any knowledge on force_having it would be greatly appreciated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜