Django slug field in Arabic and other foreign languages -
am trying build app model contains unique of title, users write title in arabic , other languages , when on save, try slugify field. return blank in case of arabic. way show arabic wordings maintain slug principles of replacing special characters , spaces dash?
class article(models.model):     title = models.charfield(max_length=100)     slug = models.slugfield()     def save(self, *args, **kwargs):      if self.slug in (none, '', u''):        self.slug = slugify(self.title)      super(article, self).save(*args, **kwargs)      
to enable url encoder, open settings.py , @ end of file, insert new line:
allow_unicode_slugs = true
Comments
Post a Comment