﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27171	#7201 Change 'unicode_literals' in TemplateCommand, change admin and view templates	Ivan	nobody	"When you run `manage.py startapp` with python2, TemplateCommand context add `from __future__ import unicode literals` at the top.
If you using non askii symbols on python2, like cyrillic alphabet, you still have an error 'SyntaxError: Non-ASCII character' because encoding not specified.
Also admin and views templates needed unicode_literals too. For example, when you put some comments in non askii or raise error message.
Here is changes of TemplateCommand Context:  


{{{
index 8c38f3f..b2ff964 100644
--- a/django/conf/app_template/admin.py-tpl
+++ b/django/conf/app_template/admin.py-tpl
@@ -1,3 +1,3 @@
-from django.contrib import admin
+{{ unicode_literals }}from django.contrib import admin
 
 # Register your models here.
diff --git a/django/conf/app_template/views.py-tpl b/django/conf/app_template/views.py-tpl
index 91ea44a..61821e7 100644
--- a/django/conf/app_template/views.py-tpl
+++ b/django/conf/app_template/views.py-tpl
@@ -1,3 +1,3 @@
-from django.shortcuts import render
+{{ unicode_literals }}from django.shortcuts import render
 
 # Create your views here.
diff --git a/django/core/management/templates.py b/django/core/management/templates.py
index df522e8..fd957fb 100644
--- a/django/core/management/templates.py
+++ b/django/core/management/templates.py
@@ -114,7 +114,8 @@ class TemplateCommand(BaseCommand):
             camel_case_name: camel_case_value,
             'docs_version': get_docs_version(),
             'django_version': django.__version__,
-            'unicode_literals': '' if six.PY3 else 'from __future__ import unicode_literals\n\n',
+            'unicode_literals': '' if six.PY3 else '# -*- coding: utf-8 -*-\n'
+                                                   'from __future__ import unicode_literals\n\n',
         }), autoescape=False)
 
         # Setup a stub settings environment for template rendering

}}}
"	Cleanup/optimization	closed	Template system	1.10	Normal	fixed	admin_scripts, TemplateCommand		Unreviewed	1	0	0	0	0	0
