ojii / django-multilingual-ng

THIS PROJECT IS *NOT* SUPPORTED AND SHOULD NOT BE USED UNLESS YOU KNOW EXACTLY WHAT YOU'RE DOING!!!

Home Page:https://github.com/KristianOellegaard/django-hvad

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exclude doesn't work

Alrond opened this issue · comments

This request makes error

Tag.objects.filter(post__in=(1,2,3,4)).exclude(post__text="").distinct() 

Error:
File "/usr/local/lib/python2.5/site-packages/django/db/models/query.py", line 557, in exclude
return self._filter_or_exclude(True, _args, *_kwargs)
File "/usr/local/lib/python2.5/site-packages/django/db/models/query.py", line 566, in _filter_or_exclude
clone.query.add_q(~Q(_args, *_kwargs))
File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/query.py", line 1128, in add_q
self.add_q(child, used_aliases)
File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/query.py", line 1131, in add_q
can_reuse=used_aliases)
File "/usr/local/lib/python2.5/site-packages/multilingual/query.py", line 119, in add_filter
can_reuse)
File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/query.py", line 1420, in split_exclude
query.add_filter(filter_expr, can_reuse=can_reuse)
File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/query.py", line 1026, in add_filter
negate=negate, process_extras=process_extras)
File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/query.py", line 1204, in setup_joins
for int_model in opts.get_base_chain(model):
TypeError: 'NoneType' object is not iterable

>>> model
class 'openblog.models.PostTranslation'>
>>> opts
<Options for Post>

Models:

class Post(models.Model):
    slug = models.SlugField(max_length=250,unique=True)
    tags = fields.TagsField(Tag)
    class Translation(multilingual.translation.TranslationModel):
        headline = models.CharField(max_length=250, blank=True)
        text = models.TextField(blank=True)

class Tag(models.Model):
    value = models.CharField(max_length=50)
    class Translation(multilingual.translation.TranslationModel):
        value_lang = models.CharField(max_length=50,blank=True)