Last active
August 29, 2015 14:09
-
-
Save RodrigoEspinosa/f99d1834b8096c601684 to your computer and use it in GitHub Desktop.
Custom haystack update_index command that disable logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from haystack.management.commands import update_index | |
class Command(update_index.Command): | |
help = 'Custom haystack update index command that disable logging' | |
def handle(self, *args, **option): | |
# Disable logging below CRITICAL while running update_index | |
logging.disable(logging.CRITICAL) | |
# Set the using option to default as default | |
if 'using' not in option: | |
option['using'] = ['default'] | |
# Set the remove option to True as default | |
if 'remove' not in option: | |
option['remove'] = True | |
# Run the update index command | |
super(Command, self).handle(**option) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i.e. use this file in
core/management/update_index.py