Model Saving Error

46 views
Skip to first unread message

Ulisses Cruz

unread,
Feb 12, 2015, 1:43:41 PM2/12/15
to django...@googlegroups.com
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?


Ulisses Cruz

unread,
Feb 12, 2015, 2:31:19 PM2/12/15
to django...@googlegroups.com
Thanks 
The problem was solved when I used another backend from:


The backend I was using was not appropriate for python 3 that I am using
but when I used:

mysqlclient-1.3.5-cp34-none-win32.whl

it start working.
Reply all
Reply to author
Forward
0 new messages