Ticket #296 (closed defect: invalid)

Opened 4 years ago

Last modified 4 years ago

ValueError When Using django-extensions TimeStampedModel

Reported by: mutaz@… Owned by: andrew
Priority: major Milestone:
Component: migrations Version: 0.6.2
Keywords: Cc:


My model is extending TimeStampedModel? class of django-extensions. However, I get the following error when I do "./ migrate blog"

Traceback (most recent call last):

File "./", line 24, in <module>


File "/Users/mutaz/django_projects/MMM/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/core/management/", line 353, in 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/", line 303, in execute


File "/Users/mutaz/django_projects/MMM/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/core/management/", 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/", line 222, in execute

output = self.handle(*args, options)

File "/Users/mutaz/django_projects/default_project/projectslibs/south/management/commands/", line 91, in handle

skip = skip,

File "/Users/mutaz/django_projects/default_project/projectslibs/south/", 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/", line 398, in run_forwards

verbosity = verbosity,

File "/Users/mutaz/django_projects/default_project/projectslibs/south/", line 297, in run_migrations

orm = klass.orm

File "/Users/mutaz/django_projects/default_project/projectslibs/south/", line 62, in get

self.orm = FakeORM(*self._args)

File "/Users/mutaz/django_projects/default_project/projectslibs/south/", line 45, in FakeORM

_orm_cache[args] = _FakeORM(*args)

File "/Users/mutaz/django_projects/default_project/projectslibs/south/", line 106, in init

self.models[name] = self.make_model(app_name, model_name, data)

File "/Users/mutaz/django_projects/default_project/projectslibs/south/", line 282, in make_model

field = self.eval_in_context(code, app, extra_imports)

File "/Users/mutaz/django_projects/default_project/projectslibs/south/", line 206, in eval_in_context

raise ValueError?("Cannot import the required field '%s'" % value)

ValueError?: Cannot import the required field 'CreationDateTimeField?'


Change History

comment:1 Changed 4 years ago by andrew

  • Status changed from new to closed
  • Resolution set to invalid

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:)

from south.modelsinspector import add_introspection_rules
add_introspection_rules(rules, ["^django_extensions\.db\.fields"])

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).


Add a comment

Modify Ticket

as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.