Hello,
I'm having dificulty with saving data to a MySQL database.
I created a simple model:
class Music(models.Model):
title = models.CharField(max_length=100)
slug = models.SlugField(null=True)
content = models.FileField(upload_to="music", null=True, blank=True)
def __str__(self):
return self.title
def save(self, *args, **kwargs):
self.slug = slugify(self.title)
super(Music, self).save(*args, **kwargs)
when I try to create a music:
>>> from myapp.models import Music
>>> Music.objects.all()
[]
>>> m=Music(title="Title of the musicr")
>>> m.save()
I'm having the following error:
File "C:\Python34\lib\site-packages\mysql\connector\cursor.py", line 860, in statement
return self._executed.strip()
AttributeError: 'NoneType' object has no attribute 'strip'
As you may notice I'm using the 'mysql.connector.django' backend to connect django to MySQL.
When I used the same model in a SQLite database no error happened.
Someone knows how I can solve this problem?