Slugfy in FLASK query

Asked

Viewed 35 times

1

I am trying to give a Slug in a given, I tried to use Lower and replace to swap some characters, my query is similar to this:

return Person.query.get(person_id).name.filter(func.lower(func.replace(Person.name, "ç", "c")) 

works, but if I get something like 'á', or some other special character, it breaks, obviously.

What’s the way around it, make a list of all the characters with the index to give an replace? something like that?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.