Ticket #296 (closed defect: invalid)
ValueError When Using django-extensions TimeStampedModel
| Reported by: | mutaz@… | Owned by: | andrew |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | migrations | Version: | 0.6.2 |
| Keywords: | Cc: |
Description
My model is extending TimeStampedModel? class of django-extensions. However, I get the following error when I do "./manage.py migrate blog"
Traceback (most recent call last):
File "./manage.py", line 24, in <module>
execute_from_command_line()
File "/Users/mutaz/django_projects/MMM/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/core/management/init.py", line 353, in execute_from_command_line
utility.execute()
File "/Users/mutaz/django_projects/MMM/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/core/management/init.py", line 303, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/mutaz/django_projects/MMM/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/core/management/base.py", line 195, in run_from_argv
self.execute(*args, options.dict)
File "/Users/mutaz/django_projects/MMM/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/core/management/base.py", line 222, in execute
output = self.handle(*args, options)
File "/Users/mutaz/django_projects/default_project/projectslibs/south/management/commands/migrate.py", line 91, in handle
skip = skip,
File "/Users/mutaz/django_projects/default_project/projectslibs/south/migration.py", line 591, in migrate_app
result = run_forwards(mapp, [mname], fake=fake, db_dry_run=db_dry_run, verbosity=verbosity)
File "/Users/mutaz/django_projects/default_project/projectslibs/south/migration.py", line 398, in run_forwards
verbosity = verbosity,
File "/Users/mutaz/django_projects/default_project/projectslibs/south/migration.py", line 297, in run_migrations
orm = klass.orm
File "/Users/mutaz/django_projects/default_project/projectslibs/south/orm.py", line 62, in get
self.orm = FakeORM(*self._args)
File "/Users/mutaz/django_projects/default_project/projectslibs/south/orm.py", line 45, in FakeORM
_orm_cache[args] = _FakeORM(*args)
File "/Users/mutaz/django_projects/default_project/projectslibs/south/orm.py", line 106, in init
self.models[name] = self.make_model(app_name, model_name, data)
File "/Users/mutaz/django_projects/default_project/projectslibs/south/orm.py", line 282, in make_model
field = self.eval_in_context(code, app, extra_imports)
File "/Users/mutaz/django_projects/default_project/projectslibs/south/orm.py", line 206, in eval_in_context
raise ValueError?("Cannot import the required field '%s'" % value)
ValueError?: Cannot import the required field 'CreationDateTimeField?'
Attachments
Change History
comment:2 Changed 4 years ago by andrew
Ahem. I meant:
from south.modelsinspector import add_introspection_rules add_introspection_rules([], ["^django_extensions\.db\.fields"])
If you want a quick explanation, I'm saying that all models in the django_extensions.db.fields module are fine to introspect with no additional rules (since they're all very simple subclasses of core Django fields, which South knows about).

Yes, you'll need to make sure South knows about the field; you can use the instructions in ExtendingIntrospection for that (more precisely, something like:)