I am trying to get list of all permissions from Permission Model.
I have tried following commands.
from django.contrib.auth.models import *
Permission.objects.all()
When I tried to execute query command then it throws following error.
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
I have checked other models like Group, User are working correctly.
faced similar kinda problem few days back try this : change installed django-registration module <--old-->
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except ImportError:
from django.contrib.auth.models import User
<--new-->
from django.conf import settings
try:
from django.contrib.auth import get_user_model
User = settings.AUTH_USER_MODEL
except ImportError:
from django.contrib.auth.models import User
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.