Skip to content

Can not slugify() german umlauts (ÄÖÜ) #162

Open
@sowinski

Description

Checklist

  • I have verified that I am using a GIS-enabled database, such as PostGIS or Spatialite.
  • I have verified that that issue exists against the master branch of django-cities.
  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • I have reduced the issue to the simplest possible case.
  • I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.)

Steps to reproduce

Download at least German cities. (Having problems with ÖÜÄ)
City.objects.filter(name="Düsseldorf").first().slugify()
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/cities/models.py", line 216, in slugify
return '{}-{}'.format(self.id, unicode_func(self.name))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 1: ordinal not in range(128)

Environment:
django-cities==0.5.0.3
Django==1.10.4
Python 2.7.6
MySql 5.5
Ubuntu trusty 32Bit

Tried to write my own slugify function, but the code is crashing before on line:
#models.py
216: return '{}-{}'.format(self.id, unicode_func(self.name))

Is it possible to define my own get_absolute_url somehow?

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions