Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#18452 closed Uncategorized (invalid)

Spaces in model field definition params cause sqlite errors

Reported by: Scot Hacker Owned by: nobody
Component: Uncategorized Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


With this class definition:

class MyModel(models.Model):

title = models.CharField(blank=True, null=True, max_length=60)

run syncdb against sqlite. The title column will end up in sqlite defined as a required field (it shouldn't be). Remove the sqlite file, and change the model slightly:

class MyModel(models.Model):

title = models.CharField(blank=True,null=True,max_length=60)

(remove the spaces between the field options). syncdb again and the column now correctly is non-required.

The presence of the space(s) between field options seems to be significant.

Change History (2)

comment:1 Changed 7 years ago by Anssi Kääriäinen

Resolution: invalid
Status: newclosed

There is something else going on. If the spaces were significant, it would mean there was a huge showstopper bug in Python. The spaces are not seen by Django at all, they are parsed by Python itself. Basically every Python project would be broken.

Closing as invalid.

comment:2 Changed 7 years ago by Scot Hacker

Hmm. I should have noted that I also tested this against mysql, and did not have a problem. It was only sqlite3 (on OS X Lion) that demonstrated the problem. I'll see if I can someone else to reproduce it on a different codebase and machine.

Note: See TracTickets for help on using tickets.
Back to Top