Forcing DEBUG disabled in timeline command

remotes/origin/enhancement/email-actions
Alejandro Alonso 2015-04-30 08:04:33 +02:00
parent a1870ab5b1
commit 214a74163f
1 changed files with 6 additions and 0 deletions

View File

@ -14,6 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.db.models import Model from django.db.models import Model
@ -111,5 +112,10 @@ def generate_timeline():
class Command(BaseCommand): class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
debug_enabled = settings.DEBUG
if debug_enabled:
print("Please, execute this script only with DEBUG mode disabled (DEBUG=False)")
return
Timeline.objects.all().delete() Timeline.objects.all().delete()
generate_timeline() generate_timeline()