title: Django Admin. UnicodeEncodeError 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
body: <p>I have views.py and models.py as follows, through the forms I have entered some non-English characters(Other Regional Language), and saved to the database. After submitting if I try to edit with my admin interface. It's giving the following error:</p>
  
  <blockquote>
    <p>UnicodeEncodeError 'ascii' codec can't encode characters in position
    0-3: ordinal not in range(128)     </p>
  </blockquote>
  
  <p>views.py:</p>
  
  <pre><code>def new_submit(request):
      if request.method == 'POST':
          form = NewsForm(request.POST)
          if form.is_valid():
              c = form.save(commit=False)
              c.author = request.user
              c.save()
              return redirect(my_submitted_news)
  
      else:
          form = NewsForm()
      return render(request, 'new_submit.html', {'form': form})
  </code></pre>
  
  <p>models.py:</p>
  
  <pre><code>class News_Post(models.Model):
      Country = models.CharField(max_length=20)
      State = models.CharField(max_length=20)
      District = models.CharField(max_length=20)
      Area = models.CharField(max_length=20)
      Photo_link = models.CharField(max_length=50, blank=True)
      News_Title = models.CharField(max_length=200)
      News = models.TextField()
      created_date = models.DateTimeField(auto_now_add=True)
      author = models.CharField(max_length=20)
  
      def __str__(self):
          return self.News_Title
  </code></pre>
  
  <p>Here is the Traceback:</p>
  
  <pre><code>Environment:
  
  
  Request Method: GET
  Request URL: http://192.168.145.155:8080/anuj_borah/news/news_post/11/change/
  
  Django Version: 1.10.5
  Python Version: 2.7.6
  
  
  Template error:
      In template /usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/change_form.html, error at line 21
      ascii   11 : {% block coltype %}colM{% endblock %}
      12 : 
      13 : {% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-form{% endblock %}
      14 : 
      15 : {% if not is_popup %}
      16 : {% block breadcrumbs %}
      17 : &lt;div class="breadcrumbs"&gt;
      18 : &lt;a href="{% url 'admin:index' %}"&gt;{% trans 'Home' %}&lt;/a&gt;
      19 : &amp;rsaquo; &lt;a href="{% url 'admin:app_list' app_label=opts.app_label %}"&gt;{{ opts.app_config.verbose_name }}&lt;/a&gt;
      20 : &amp;rsaquo; {% if has_change_permission %}&lt;a href="{% url opts|admin_urlname:'changelist' %}"&gt;{{ opts.verbose_name_plural|capfirst }}&lt;/a&gt;{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %}
      21 : &amp;rsaquo; {% if add %}{% blocktrans with name=opts.verbose_name %}Add {{ name }}{% endblocktrans %}{% else %} {{ original|truncatewords:"18" }}  {% endif %}
      22 : &lt;/div&gt;
      23 : {% endblock %}
      24 : {% endif %}
      25 : 
      26 : {% block content %}&lt;div id="content-main"&gt;
      27 : {% block object-tools %}
      28 : {% if change %}{% if not is_popup %}
      29 :   &lt;ul class="object-tools"&gt;
      30 :     {% block object-tools-items %}
      31 :     &lt;li&gt;
  
  
  Traceback:
  
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py" in inner
    39.             response = get_response(request)
  
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _legacy_get_response
    249.             response = self._get_response(request)
  
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
    217.                 response = self.process_exception_by_middleware(e, request)
  
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
    215.                 response = response.render()
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/response.py" in render
    109.             self.content = self.rendered_content
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/response.py" in rendered_content
    86.         content = template.render(context, self._request)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/backends/django.py" in render
    66.             return self.template.render(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
    208.                     return self._render(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in _render
    199.         return self.nodelist.render(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
    994.                 bit = node.render_annotated(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render_annotated
    961.             return self.render(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py" in render
    174.         return compiled_parent._render(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in _render
    199.         return self.nodelist.render(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
    994.                 bit = node.render_annotated(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render_annotated
    961.             return self.render(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py" in render
    174.         return compiled_parent._render(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in _render
    199.         return self.nodelist.render(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
    994.                 bit = node.render_annotated(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render_annotated
    961.             return self.render(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/defaulttags.py" in render
    315.                 return nodelist.render(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
    994.                 bit = node.render_annotated(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render_annotated
    961.             return self.render(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py" in render
    70.                 result = block.nodelist.render(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
    994.                 bit = node.render_annotated(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render_annotated
    961.             return self.render(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/defaulttags.py" in render
    315.                 return nodelist.render(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
    994.                 bit = node.render_annotated(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render_annotated
    961.             return self.render(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
    1044.             output = self.filter_expression.resolve(context)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in resolve
    739.                 new_obj = func(obj, *arg_vals)
  
  File "/usr/local/lib/python2.7/dist-packages/django/template/defaultfilters.py" in _dec
    47.             args[0] = force_text(args[0])
  
  File "/usr/local/lib/python2.7/dist-packages/django/utils/encoding.py" in force_text
    80.                 s = six.text_type(bytes(s), encoding, errors)
  
  Exception Type: UnicodeEncodeError at /anuj_borah/news/news_post/11/change/
  Exception Value: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
  </code></pre>