Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#426 closed defect (fixed)

ContentTypeDoesNotExist thrown whenever CRUD actions are performed in admin

Reported by: jmadson@… Owned by: Adrian Holovaty
Component: contrib.admin Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Whenever I create, modify, or delete objects in the admin interface for my project I recieve the following error:

There's been an error:

Traceback (most recent call last):

  File "/usr/lib/python2.3/site-packages/django/core/handlers/", line 64, in get_response
    response = callback(request, **param_dict)

  File "/usr/lib/python2.3/site-packages/django/views/admin/", line 894, in change_stage
    log.log_action(, opts.get_content_type_id(), pk_value, repr(new_object), log.CHANGE, change_message)

  File "/usr/lib/python2.3/site-packages/django/core/meta/", line 241, in get_content_type_id
    self._content_type_id = mod.get_object(python_module_name__exact=self.module_name, package__label__exact=self.app_label).id

  File "/usr/lib/python2.3/site-packages/django/utils/", line 3, in _curried
    return args[0](*(args[1:]+moreargs), **dict(kwargs.items() + morekwargs.items()))

  File "/usr/lib/python2.3/site-packages/django/core/meta/", line 1082, in function_get_object
    raise does_not_exist_exception, "%s does not exist for %s" % (opts.object_name, kwargs)

ContentTypeDoesNotExist: ContentType does not exist for {'package__label__exact': 'myproject', 'python_module_name__exact': 'foos'}

The action always works, but this error is thrown nonetheless.

Change History (2)

comment:1 Changed 13 years ago by Jacob

Resolution: fixed
Status: newclosed

This means you haven't correct inserted into the database the metadata Django needs to keep track of your objects. Do sqlinitialdata <yourapp> to see what this metadata should be, and insert it yourself. (django-admin install would have done this for you, but if you're getting this message it means you didn't use install).

comment:2 Changed 13 years ago by jmadson@…

Thanks! Perhaps that exception should print something to that effect?

Note: See TracTickets for help on using tickets.
Back to Top