Reputation: 375
I have a problem so the problem is I have a DetailView. When the object is not found, I get:
'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)
The string that could not be encoded/decoded was: ��quip
Traceback:
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response
114. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Python27\lib\site-packages\django\views\generic\base.py" in view
69. return self.dispatch(request, *args, **kwargs)
File "C:\Python27\lib\site-packages\django\views\generic\base.py" in dispatch
87. return handler(request, *args, **kwargs)
File "C:\Python27\lib\site-packages\django\views\generic\detail.py" in get
110. self.object = self.get_object()
File "C:\Python27\lib\site-packages\django\views\generic\detail.py" in get_object
55. {'verbose_name': queryset.model._meta.verbose_name})
Exception Type: UnicodeDecodeError at /teams/arsenal-3-66/
Exception Value: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)
It does this instead of returning a 404....
I don't know what to do.
The detail view is simple:
class TeamDetailView(generic.DetailView):
model = Team
template_name = 'teams/team.html'
And the model is simple also:
class Team(models.Model):
name = models.CharField(max_length=25,verbose_name=_("name"))
slug = AutoSlugField(unique=True,populate_from='name')
class Meta:
verbose_name = 'Équipe'
verbose_name_plural = 'Équipes'
def __unicode__(self): # Python 2.7: def __unicode__(self):
return self.name
Thanks, Ara
Upvotes: 0
Views: 155
Reputation: 375
Well it was a dumb error.
All I had to do was:
class Meta:
verbose_name = u'Équipe'
verbose_name_plural = u'Équipes'
Upvotes: 1