Discussion:
AttributeError: 'NoneType' object has no attribute '_meta' - during South migration
Dave E
2010-06-14 15:13:57 UTC
Permalink
I'm migrating James Bennett's 'Cotrane' blog app (adding a 'modified'
date field) using South on the existing app (with data already
present). These are the steps, and the traceback. Posting here because
the exact same error (in this post's title) also appears in Django and
Dmigrations bug reports e.g.:

Django - Trying to filter an instance of EmptyQuerySet? (apparently
fixed Jan 2010):
http://code.djangoproject.com/ticket/7235
Dmigrations:
http://code.google.com/p/dmigrations/issues/detail?id=17

Version: Django (1, 2, 1, 'final', 0)
---
1. Add 'south' to installed apps

2. ./manage.py syncdb
Syncing...
Creating table south_migrationhistory
django.contrib.auth
[...]
cms.search
coltrane
tagging
south
[...]

3. ./manage.py convert_to_south coltrane
Creating migrations directory at '/Users/[myuser]/django-apps/
coltrane/
migrations'...
Creating __init__.py in '/Users/[myuser]/django-apps/coltrane/
migrations'...
+ Added model coltrane.Category
+ Added model coltrane.Entry
+ Added M2M table for categories on coltrane.Entry
Created 0001_initial.py. You can now apply this migration with: ./
manage.py migrate coltrane
- Soft matched migration 0001 to 0001_initial.
Running migrations for coltrane:
- Migrating forwards to 0001_initial.
coltrane:0001_initial
(faked)
Traceback (most recent call last):
File "./manage.py", line 11, in <module>
execute_manager(settings)
File "[...]django-trunk/django/core/management/__init__.py", line
438, in execute_manager
utility.execute()
File "[...]django-trunk/django/core/management/__init__.py", line
379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "[...]django-trunk/django/core/management/base.py", line 191,
in run_from_argv
self.execute(*args, **options.__dict__)
File "[...]django-trunk/django/core/management/base.py", line 220,
in execute
output = self.handle(*args, **options)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/South-0.7.1-py2.6.egg/south/management/
commands/convert_to_south.py", line 74, in handle
management.call_command("migrate", app, "0001", fake=True,
verbosity=verbosity)
File "[...]django-trunk/django/core/management/__init__.py", line
166, in call_command
return klass.execute(*args, **defaults)
File "[...]django-trunk/django/core/management/base.py", line 220,
in execute
output = self.handle(*args, **options)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/South-0.7.1-py2.6.egg/south/management/
commands/migrate.py", line 109, in handle
ignore_ghosts = ignore_ghosts,
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/South-0.7.1-py2.6.egg/south/migration/
__init__.py", line 205, in migrate_app
post_migrate.send(None, app=app_label)
File "[...]django-trunk/django/dispatch/dispatcher.py", line 162, in
send
response = receiver(signal=self, sender=sender, **named)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/South-0.7.1-py2.6.egg/south/signals.py", line
22, in create_permissions_compat
create_permissions(get_app(app), (), 0)
File "[...]django-trunk/django/contrib/auth/management/__init__.py",
line 25, in create_permissions
ctype = ContentType.objects.get_for_model(klass)
File "[...]django-trunk/django/contrib/contenttypes/models.py", line
40, in get_for_model
self._add_to_cache(self.db, ct)
File "[...]django-trunk/django/contrib/contenttypes/models.py", line
70, in _add_to_cache
key = (model._meta.app_label, model._meta.object_name.lower())
AttributeError: 'NoneType' object has no attribute '_meta'
---
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Dave E
2010-06-14 19:53:03 UTC
Permalink
I should have also said: 'errr... help please, what now?'
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Dave E
2010-06-18 07:51:08 UTC
Permalink
Andrew Godwin from the South user group replied: "It looks like this
is a bug in the permissions-creating code, however, and not in South
itself (although it might be triggered by the way South fiddles with
the ORM)."

Ideas, anyone?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Loading...