Dropdown list in django
📁 List, Advanced Python Topics, question, django
I'm writing a simple online store on Django 1.9. I have the following models:
tovar/models.py
class Color(models.Model): color = models.CharField(verbose_name=""Color"", max_length=25, blank=False, null=True) code = models.CharField(verbose_name=""Color code"", max_length=8, blank=True, null=True)class Tovar(models.Model): color = models.ManyToManyField(Color, blank=True)cart/models.py
When working with the console in Windows, the cp866 encoding is used. This is the reason for the encoding error.
Try converting from cp866 to utf-8
name = name.decode('cp866').encode('utf-8') Log in to leave an answer