Ticket #606 (closed defect: invalid)
The "convert_to_south" command fails if "models" is a package (directory)
|Reported by:||al.the.x@…||Owned by:||andrew|
I've attempted this several different times to test it, but if the "models" module is a package - a directory containing an __init__.py file and others that are imported therein - the "convert_to_south" command fails upon trying to apply the migrations. I imagine that other South-supplied commands would also fail. Example:
>>> ./project/manage.py convert_to_south accounts Creating migrations directory at '.../project/accounts/migrations'... Creating __init__.py in '.../project/accounts/migrations'... + Added model accounts.Client + Added model accounts.Caregiver + Added model accounts.Address + Added model accounts.PhoneNumber + Added model accounts.UserProfile + Added model accounts.Unavailability Created 0001_initial.py. You can now apply this migration with: ./manage.py migrate accounts - Soft matched migration 0001 to 0001_initial. Running migrations for accounts: - Nothing to migrate. - Loading initial data for accounts. No fixtures found. None Traceback (most recent call last): File "./project/manage.py", line 11, in <module> execute_manager(settings) File "/.../django/core/management/__init__.py", line 438, in execute_manager utility.execute() File "/.../django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/.../django/core/management/base.py", line 191, in run_from_argv self.execute(*args, **options.__dict__) File "/.../django/core/management/base.py", line 218, in execute output = self.handle(*args, **options) File "/.../south/management/commands/convert_to_south.py", line 74, in handle management.call_command("migrate", app, "0001", fake=True, verbosity=verbosity) File "/.../django/core/management/__init__.py", line 166, in call_command return klass.execute(*args, **defaults) File "/.../django/core/management/base.py", line 218, in execute output = self.handle(*args, **options) File "/.../south/management/commands/migrate.py", line 109, in handle ignore_ghosts = ignore_ghosts, File "/.../south/migration/__init__.py", line 215, in migrate_app post_migrate.send(None, app=app_label) File "/.../django/dispatch/dispatcher.py", line 162, in send response = receiver(signal=self, sender=sender, **named) File "/.../south/signals.py", line 22, in create_permissions_compat create_permissions(get_app(app), (), 0) File "/.../django/contrib/auth/management/__init__.py", line 25, in create_permissions ctype = ContentType.objects.get_for_model(klass) File "/.../django/contrib/contenttypes/models.py", line 40, in get_for_model self._add_to_cache(self.db, ct) File "/.../django/contrib/contenttypes/models.py", line 71, in _add_to_cache key = (model._meta.app_label, model._meta.object_name.lower()) AttributeError: 'NoneType' object has no attribute '_meta'
While its a component of "django.contrib.contenttypes" that's complaining, I don't get the same error when running "syncdb" without South installed. The content types are correctly installed by "syncdb", even after I "reset" them (and South). All my apps currently organize models into Python packages, but I was able to create a fresh application that didn't, sync it, and convert it to South successfully.
- Status changed from new to infoneeded
- Milestone set to 0.7.3