I have a doubt about MultilingualManager.
Suppose you have the following models.py and translation.py.
Then when I wont to retrieve only published objects using the custom PublishManager, I get all the objects, not only published==True.
## translation.py
from modeltranslation.translator import translator,TranslationOptions
from foo.models import Bar
class BarTranslationOptions(TranslationOptions):
fields = ('text',)
translator.register(Bar, BarTranslationOptions)
##models.py
from django.db import models
class PublishManager(models.Manager):
def get_query_set(self):
return super(PublishManager, self).get_query_set().filter(publish=True)
class Foo(models.Model):
text = models.CharField(max_length=100)
publish = models.BooleanField(default=True)
objects = models.Manager()
published = PublishManager()
class Meta:
abstract = True
def __unicode__(self):
return self.text
class Bar(Foo):
pass
>>> from foo.models import Bar
>>> Bar.objects.all()
[<Bar: aa>, <Bar: bb>]
>>> Bar.published.all()
[<Bar: aa>, <Bar: bb>]
>>> Bar.published.__class__
<class 'modeltranslation.translator.NewMultilingualManager'>
>>> a=Bar.objects.all()[0]
>>> b=Bar.objects.all()[1]
>>> a.publish
True
>>> b.publish
False
>>>
This is the expected behavior of MultilingualManager patch? I does not understand this behavior... or its some class of bug?
Currently, I'm using Django==1.4.17 and django-modeltranlation==0.9