Django UnicodeDecodeError at /member/user_locations/ 'utf8' codec can't decode byte 0xcf in position 743: invalid continuation byte?

Good day!

In all files is: # -*- coding:utf-8 -*-

from django.contrib.auth.models import User

 class Location(models.Model):

 user = models.ForeignKey(User)

 name = models.CharField(max_length=100, verbose_name="Location", default=u")
 types = models.ManyToManyField(LocationType)
 equipment = models.ManyToManyField(Equipment)
 visit_times = models.ManyToManyField(VisitTime)
 keywords = models.CharField(max_length=100, verbose_name="Key words", default=u")
 description = models.TextField(null=True, blank=True)

 def __unicode__(self):

class UserLocationsListView(ListView):
 model = Location
 context_object_name = 'user_locations'
 template_name = "user_locations.html"
 paginated_by = 10

 def get_queryset(self):
 queryset = super(UserLocationsListView, self).get_queryset()
 queryset = queryset.filter(user=self.request.user) 
 # here PyCharm complains and says that the unresolved attribute reference 'request'

 return a queryset

url(r'^member/user_locations/$', UserLocationsListView.as_view(), name='user_locations'),


{% load staticfiles %}

 {% block content %}

 <div class="container">
 <div class="row user-locations">
 <div class="col-md-6 col-md-offset-3">

 {% for user_location in user_locations %}
 <h3><a href="#">{{ }}</a></h3>
 {% endfor %}


 {% endblock %}


Exception Type: UnicodeDecodeError
 Exception Value: 'utf8' codec can't decode byte 0xcf in position 743: invalid continuation byte
 Exception Location: C:\commercial_projects\fl\lib\ in decode, line 314

 Unicode error hint

 The string that could not be encoded/decoded was: ink">������
 Traceback Switch to copy-and-paste view

 C:\commercial_projects\fl\lib\site-packages\django\core\handlers\ in get_response
 response = response.render() ...
 ▶ Local vars
 C:\commercial_projects\fl\lib\site-packages\django\template\ in render
 self.content = self.rendered_content ...
 ▶ Local vars
 C:\commercial_projects\fl\lib\site-packages\django\template\ in rendered_content
 template = self._resolve_template(self.template_name) ...
 ▶ Local vars
 C:\commercial_projects\fl\lib\site-packages\django\template\ in _resolve_template
 new_template = self.resolve_template(template) ...
 ▶ Local vars
 C:\commercial_projects\fl\lib\site-packages\django\template\ in resolve_template
 return loader.select_template(template, using=self.using) ...
 ▶ Local vars
 C:\commercial_projects\fl\lib\site-packages\django\template\ in select_template
 return engine.get_template(template_name, dirs) ...
 ▶ Local vars
 C:\commercial_projects\fl\lib\site-packages\django\template\backends\ in get_template
 return Template(self.engine.get_template(template_name, dirs)) ...
 ▶ Local vars
 C:\commercial_projects\fl\lib\site-packages\django\template\ in get_template
 template, origin = self.find_template(template_name, dirs) ...
 ▶ Local vars
 C:\commercial_projects\fl\lib\site-packages\django\template\ in find_template
 source, display_name = loader(name, dirs) ...
 ▶ Local vars
 C:\commercial_projects\fl\lib\site-packages\django\template\loaders\ in __call__
 return self.load_template(template_name, template_dirs) ...
 ▶ Local vars
 C:\commercial_projects\fl\lib\site-packages\django\template\loaders\ in load_template
 template_name, template_dirs) ...
 ▶ Local vars
 C:\commercial_projects\fl\lib\site-packages\django\template\loaders\ in load_template_source
 return, filepath ...
 ▶ Local vars
 C:\commercial_projects\fl\lib\ in decode
 (result, consumed) = self._buffer_decode(data, self.errors, final) ...
 ▶ Local vars

Thank you!!!
July 9th 19 at 13:08
1 answer
July 9th 19 at 13:10
def __unicode__(self):
 return u"{}".format(
no.. did not help.. but thanks! ) - Mackenzie.Pfannersti commented on July 9th 19 at 13:13
And if so:
verbose_name=u"Location" - morris.Dickens commented on July 9th 19 at 13:16
thank you! problem solved... for some strange reason was a dummy template... intuitive rewrote it again... one to one as it was...and the error is gone :) - Mackenzie.Pfannersti commented on July 9th 19 at 13:19

Find more questions by tags Django