#24712: UUIDField doesn't work with SQLite3 and Django 1.8
----------------------------------------------+--------------------
     Reporter:  rclsilver                     |      Owner:  nobody
         Type:  Bug                           |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  1.8
     Severity:  Normal                        |   Keywords:
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+--------------------
 I have the following model with django 1.8:


 {{{
 class File(models.Model):
     uuid = models.UUIDField(_("id"), primary_key=True, default=uuid.uuid4,
 editable=False)
     path = models.CharField(_("path"), max_length=512)
     parent = models.ForeignKey("Folder", verbose_name=_("parent folder"),
 related_name="children", blank=True, null=True)
     absent = models.BooleanField(_("absent"), default=False)


 class Folder(File):
     pass


 class RootFolder(File):
     description = models.TextField(_("description"), blank=True,
 null=True)


 class RootFolderAuthorization(models.Model):
     user = models.ForeignKey(User, verbose_name=_("user"),
 related_name="folders", blank=True, null=True)
     group = models.ForeignKey(Group, verbose_name=_("group"),
 related_name="folders", blank=True, null=True)
     folder = models.ForeignKey(RootFolder, verbose_name=_("folder"),
 related_name="authorizations")
     can_read = models.BooleanField(_("read access"), default=True)
     can_write = models.BooleanField(_("write access"), default=False)


 class IncomingFolder(RootFolder):
     pass


 class OutgoingFolder(RootFolder):
     url = models.CharField(_("url"), max_length=512)
     username = models.CharField(_("username"), max_length=32, blank=True,
 null=True)
     password = models.CharField(_("password"), max_length=128, blank=True,
 null=True)
 }}}

 When i try to create a new "IncomingFolder", i have the following output:

 {{{
 $ ./manage.py shell
 Python 2.7.9 (default, Dec 11 2014, 04:42:00)
 [GCC 4.9.2] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 (InteractiveConsole)
 >>> from ft_node.models import IncomingFolder
 >>> f = IncomingFolder()
 >>> f.path = "/var/tmp/in1"
 >>> f.save()
 Traceback (most recent call last):
   File "<console>", line 1, in <module>
   File "/home/thomas.xxx/Documents/Work/Applications/01-Developpement
 /file-transfer/lib/python2.7/site-packages/django/db/models/base.py", line
 710, in save
     force_update=force_update, update_fields=update_fields)
   File "/home/thomas.xxx/Documents/Work/Applications/01-Developpement
 /file-transfer/lib/python2.7/site-packages/django/db/models/base.py", line
 738, in save_base
     updated = self._save_table(raw, cls, force_insert, force_update,
 using, update_fields)
   File "/home/thomas.xxx/Documents/Work/Applications/01-Developpement
 /file-transfer/lib/python2.7/site-packages/django/db/models/base.py", line
 803, in _save_table
     forced_update)
   File "/home/thomas.xxx/Documents/Work/Applications/01-Developpement
 /file-transfer/lib/python2.7/site-packages/django/db/models/base.py", line
 840, in _do_update
     return update_fields is not None or filtered.exists()
   File "/home/thomas.xxx/Documents/Work/Applications/01-Developpement
 /file-transfer/lib/python2.7/site-packages/django/db/models/query.py",
 line 586, in exists
     return self.query.has_results(using=self.db)
   File "/home/thomas.xxx/Documents/Work/Applications/01-Developpement
 /file-transfer/lib/python2.7/site-packages/django/db/models/sql/query.py",
 line 479, in has_results
     return compiler.has_results()
   File "/home/thomas.xxx/Documents/Work/Applications/01-Developpement
 /file-transfer/lib/python2.7/site-
 packages/django/db/models/sql/compiler.py", line 808, in has_results
     return bool(self.execute_sql(SINGLE))
   File "/home/thomas.xxx/Documents/Work/Applications/01-Developpement
 /file-transfer/lib/python2.7/site-
 packages/django/db/models/sql/compiler.py", line 837, in execute_sql
     cursor.execute(sql, params)
   File "/home/thomas.xxx/Documents/Work/Applications/01-Developpement
 /file-transfer/lib/python2.7/site-packages/django/db/backends/utils.py",
 line 79, in execute
     return super(CursorDebugWrapper, self).execute(sql, params)
   File "/home/thomas.xxx/Documents/Work/Applications/01-Developpement
 /file-transfer/lib/python2.7/site-packages/django/db/backends/utils.py",
 line 64, in execute
     return self.cursor.execute(sql, params)
   File "/home/thomas.xxx/Documents/Work/Applications/01-Developpement
 /file-transfer/lib/python2.7/site-packages/django/db/utils.py", line 97,
 in __exit__
     six.reraise(dj_exc_type, dj_exc_value, traceback)
   File "/home/thomas.xxx/Documents/Work/Applications/01-Developpement
 /file-transfer/lib/python2.7/site-packages/django/db/backends/utils.py",
 line 64, in execute
     return self.cursor.execute(sql, params)
   File "/home/thomas.xxx/Documents/Work/Applications/01-Developpement
 /file-transfer/lib/python2.7/site-
 packages/django/db/backends/sqlite3/base.py", line 318, in execute
     return Database.Cursor.execute(self, query, params)
 InterfaceError: Error binding parameter 0 - probably unsupported type.
 >>>
 }}}

 The same model works with MySQL.

 I installed django from git master branch (1.9) and it works too.

 I  tried to install django 1.8 from the stable/1.8.x branch and it doesn't
 work neither.

--
Ticket URL: <https://code.djangoproject.com/ticket/24712>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.2f99cc7e6a17e311e463a5bbcade4ab5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to