Skip to content

Instantly share code, notes, and snippets.

@RodrigoEspinosa
Last active August 29, 2015 14:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RodrigoEspinosa/f99d1834b8096c601684 to your computer and use it in GitHub Desktop.
Save RodrigoEspinosa/f99d1834b8096c601684 to your computer and use it in GitHub Desktop.
Custom haystack update_index command that disable logging
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)
@RodrigoEspinosa
Copy link
Author

i.e. use this file in core/management/update_index.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment