def handle(self, *fixture_labels, **options):
        if self.can_import_settings and hasattr(self, 'locale'):
            from django.utils import translation
            translation.activate(self.locale)

        mode = options.get('populate')
        if mode is not None:
            with auto_populate(mode):
                return super(Command, self).handle(*fixture_labels, **options)
        else:
            return super(Command, self).handle(*fixture_labels, **options)
示例#2
0
    def handle(self, *fixture_labels, **options):
        if self.can_import_settings and hasattr(self, 'locale'):
            from django.utils import translation
            translation.activate(self.locale)

        mode = options.get('populate')
        if mode is not None:
            with auto_populate(mode):
                return super(Command, self).handle(*fixture_labels, **options)
        else:
            return super(Command, self).handle(*fixture_labels, **options)
示例#3
0
 def get_or_create(self, **kwargs):
     """
     Allows to override population mode with a ``populate`` method.
     """
     with auto_populate(self._populate_mode):
         return super(MultilingualQuerySet, self).get_or_create(**kwargs)