def test_slugify(self): items = ( ('Hello, World!', 'hello-world'), ('spam & eggs', 'spam-eggs'), ) for value, output in items: self.assertEqual(text.slugify(value), output)
def slugify(value): """ Converts to lowercase, removes non-word characters (alphanumerics and underscores) and converts spaces to hyphens. Also strips leading and trailing whitespace. """ from djangocg.utils.text import slugify return slugify(value)