Django prefetch related and django hvad -


i have following model , using django-hvad translations

class footype(translatablemodel):     code = models.charfield(max_length=255, unique=true)     translations = translatedfields(name=models.charfield(max_length=255))      def __unicode__(self):         return self.lazy_translation_getter('name') 

any time ask list of hotel types;

it makes following query many times

select ••• "foo_footype_translation" "foo_foo_type_translation"."master_id" = 159 limit 1 

i have apply prefetch_related time call unicode. there way that?

edit: looking @ docs, looks should using translationmanager

from hvad.manager import translationmanager  class footype(translatablemodel):     ...      objects = translationmanager() 

ref: http://django-hvad.readthedocs.org/en/latest/public/queryset.html#translationqueryset


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -