#21954: 1.7a1 - Migration syntax error ---------------------------------+--------------------------------------- Reporter: caulagi | Owner: Type: Bug | Status: new Component: Migrations | Version: 1.7-alpha-1 Severity: Release blocker | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ---------------------------------+--------------------------------------- Description changed by russellm:
Old description: > I am using the following (simplified) model that doesn't migrate using > the new migrations in Django 1.7a1 - > > $ > $ pip freeze > Django==1.7a1 > argparse==1.2.1 > distribute==0.6.34 > wsgiref==0.1.2 > $ > $ cat blog/models.py > from django.db import models > from django.utils import timezone > > class Blog(models.Model): > > title = models.CharField(max_length=200) > created = models.DateTimeField(default=timezone.now()) > > def __unicode__(self): > return self.title > > $ > $ python manage.py makemigrations > Migrations for 'blog': > 0001_initial.py: > - Create model Blog > $ > $ python manage.py migrate > Traceback (most recent call last): > File "manage.py", line 10, in <module> > execute_from_command_line(sys.argv) > File "/home/pcaulagi/projects/test/local/lib/python2.7/site- > packages/Django-1.7a1-py2.7.egg/django/core/management/__init__.py", line > 427, in execute_from_command_line > utility.execute() > File "/home/pcaulagi/projects/test/local/lib/python2.7/site- > packages/Django-1.7a1-py2.7.egg/django/core/management/__init__.py", line > 419, in execute > self.fetch_command(subcommand).run_from_argv(self.argv) > File "/home/pcaulagi/projects/test/local/lib/python2.7/site- > packages/Django-1.7a1-py2.7.egg/django/core/management/base.py", line > 288, in run_from_argv > self.execute(*args, **options.__dict__) > File "/home/pcaulagi/projects/test/local/lib/python2.7/site- > packages/Django-1.7a1-py2.7.egg/django/core/management/base.py", line > 337, in execute > output = self.handle(*args, **options) > File "/home/pcaulagi/projects/test/local/lib/python2.7/site- > packages/Django-1.7a1-py2.7.egg/django/core/management/commands/migrate.py", > line 62, in handle > executor = MigrationExecutor(connection, > self.migration_progress_callback) > File "/home/pcaulagi/projects/test/local/lib/python2.7/site- > packages/Django-1.7a1-py2.7.egg/django/db/migrations/executor.py", line > 14, in __init__ > self.loader = MigrationLoader(self.connection) > File "/home/pcaulagi/projects/test/local/lib/python2.7/site- > packages/Django-1.7a1-py2.7.egg/django/db/migrations/loader.py", line 48, > in __init__ > self.build_graph() > File "/home/pcaulagi/projects/test/local/lib/python2.7/site- > packages/Django-1.7a1-py2.7.egg/django/db/migrations/loader.py", line > 145, in build_graph > self.load_disk() > File "/home/pcaulagi/projects/test/local/lib/python2.7/site- > packages/Django-1.7a1-py2.7.egg/django/db/migrations/loader.py", line > 103, in load_disk > migration_module = import_module("%s.%s" % (module_name, > migration_name)) > File "/usr/lib/python2.7/importlib/__init__.py", line 37, in > import_module > __import__(name) > File "/tmp/bar/blog/migrations/0001_initial.py", line 17 > ('created', models.DateTimeField(default=datetime.datetime(2014, 2, > 4, 9, 15, 59, 685251, tzinfo=<UTC>))), > > ^ > SyntaxError: invalid syntax > $ > $ > > We have had an initial discussion on django-users - > https://groups.google.com/forum/#!topic/django-users/5ryEZd7I1t8 New description: I am using the following (simplified) model that doesn't migrate using the new migrations in Django 1.7a1 - {{{ $ $ pip freeze Django==1.7a1 argparse==1.2.1 distribute==0.6.34 wsgiref==0.1.2 $ $ cat blog/models.py from django.db import models from django.utils import timezone class Blog(models.Model): title = models.CharField(max_length=200) created = models.DateTimeField(default=timezone.now()) def __unicode__(self): return self.title $ $ python manage.py makemigrations Migrations for 'blog': 0001_initial.py: - Create model Blog $ $ python manage.py migrate Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/pcaulagi/projects/test/local/lib/python2.7/site- packages/Django-1.7a1-py2.7.egg/django/core/management/__init__.py", line 427, in execute_from_command_line utility.execute() File "/home/pcaulagi/projects/test/local/lib/python2.7/site- packages/Django-1.7a1-py2.7.egg/django/core/management/__init__.py", line 419, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/pcaulagi/projects/test/local/lib/python2.7/site- packages/Django-1.7a1-py2.7.egg/django/core/management/base.py", line 288, in run_from_argv self.execute(*args, **options.__dict__) File "/home/pcaulagi/projects/test/local/lib/python2.7/site- packages/Django-1.7a1-py2.7.egg/django/core/management/base.py", line 337, in execute output = self.handle(*args, **options) File "/home/pcaulagi/projects/test/local/lib/python2.7/site- packages/Django-1.7a1-py2.7.egg/django/core/management/commands/migrate.py", line 62, in handle executor = MigrationExecutor(connection, self.migration_progress_callback) File "/home/pcaulagi/projects/test/local/lib/python2.7/site- packages/Django-1.7a1-py2.7.egg/django/db/migrations/executor.py", line 14, in __init__ self.loader = MigrationLoader(self.connection) File "/home/pcaulagi/projects/test/local/lib/python2.7/site- packages/Django-1.7a1-py2.7.egg/django/db/migrations/loader.py", line 48, in __init__ self.build_graph() File "/home/pcaulagi/projects/test/local/lib/python2.7/site- packages/Django-1.7a1-py2.7.egg/django/db/migrations/loader.py", line 145, in build_graph self.load_disk() File "/home/pcaulagi/projects/test/local/lib/python2.7/site- packages/Django-1.7a1-py2.7.egg/django/db/migrations/loader.py", line 103, in load_disk migration_module = import_module("%s.%s" % (module_name, migration_name)) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/tmp/bar/blog/migrations/0001_initial.py", line 17 ('created', models.DateTimeField(default=datetime.datetime(2014, 2, 4, 9, 15, 59, 685251, tzinfo=<UTC>))), ^ SyntaxError: invalid syntax $ $ }}} We have had an initial discussion on django-users - https://groups.google.com/forum/#!topic/django-users/5ryEZd7I1t8 -- -- Ticket URL: <https://code.djangoproject.com/ticket/21954#comment:4> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.32a17c6f9025c4d51ec0cd1d11cd2650%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.