문제

How can I successfully delete the stale content?
Typing yes yields the following:

Creating tables ...

The following content types are stale and need to be deleted:

auth | message

Any objects related to these content types by a foreign key will also be deleted. Are you sure you want to delete these content types? If you're unsure, answer 'no'.

Type 'yes' to continue, or 'no' to cancel: yes

Traceback (most recent call last): ...

raise errorclass, errorvalue
django.db.utils.DatabaseError: 
(1146, "Table '<db_name>.auth_group_permissions' doesn't exist")
Process finished with exit code 1

The other thing I tried was:

from django.contrib.contenttypes.models import ContentType
ct = ContentType.objects.get(app_label='auth',model='messages')

And I receive the following:

DoesNotExist: ContentType matching query does not exist.
도움이 되었습니까?

해결책

You can do a

python manage.py dbshell

and check all the tables created by you before.

See if auth_group_permissions exists. If it's not there, I guess you can manually create it and do the process again.

다른 팁

The model field of the contenttype of the auth.message is 'message' instead of 'messages'.
so try

ct = ContentType.objects.get(app_label='auth',model='message')

You could then list ct.permission_set.all() or even run ct.delete() (in transaction and print relative objects to be deleted) to reproduce the issue.

Also, the error about 'missing table' is weird, can you check in DB whether the table really exists? Or do you have multiple DBs configured in 1.3?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top