6👍
✅
You are using Python 2 syntax in Python 3. Although Python 3.3 and up support using the u
prefix for unicode string values (to support cross-version code), Python 3.2 and before do not; remove the u
prefix to make it work:
def __unicode__(self):
return '%s %s' % (self.first_name, self.last_name)
However, you will also need to consult the Django Porting to Python 3 documentation and use __str__
, not __unicode__
here:
def __str__(self):
return '%s %s' % (self.first_name, self.last_name)
If you are following a specific book, you may want to install Python 2 instead.
Source:stackexchange.com