From 79d1d3986fa11bd2dfec5cda81b84b50475ec0fd Mon Sep 17 00:00:00 2001 From: Nikolaus Schlemm Date: Wed, 19 Jun 2019 12:15:59 +0200 Subject: [PATCH] Fixes #99 by replacing raw_input with input added (propably obsolete) backwards compatability as django already threw out six --- dbtemplates/management/commands/sync_templates.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dbtemplates/management/commands/sync_templates.py b/dbtemplates/management/commands/sync_templates.py index 020313e..dc1d2a2 100644 --- a/dbtemplates/management/commands/sync_templates.py +++ b/dbtemplates/management/commands/sync_templates.py @@ -1,16 +1,17 @@ import io import os +import sys from django.contrib.sites.models import Site from django.core.management.base import CommandError, BaseCommand from django.template.utils import get_app_template_dirs from django.template.loader import _engine_list -try: - from django.utils.six import input as raw_input -except ImportError: - pass from dbtemplates.models import Template +# (propably obsolete) backwards compatability as django already threw out six +if sys.version_info[0] == 2: + input = raw_input + ALWAYS_ASK, FILES_TO_DATABASE, DATABASE_TO_FILES = ('0', '1', '2') DIRS = [] @@ -82,7 +83,7 @@ class Command(BaseCommand): t = Template.on_site.get(name__exact=name) except Template.DoesNotExist: if not force: - confirm = raw_input( + confirm = input( "\nA '%s' template doesn't exist in the " "database.\nCreate it with '%s'?" " (y/[n]): """ % (name, path)) @@ -94,7 +95,7 @@ class Command(BaseCommand): else: while 1: if overwrite == ALWAYS_ASK: - confirm = raw_input( + confirm = input( "\n%(template)s exists in the database.\n" "(1) Overwrite %(template)s with '%(path)s'\n" "(2) Overwrite '%(path)s' with %(template)s\n"