try: user = User.objects.get(username = 'xyz') custom_permission = Permission.objects.get(codename='is_custom') user.user_permissions.add(custom_permission) user.save() print user.has_perm("is_custom") print user.has_perm('app.is_custom') user.get_all_permissions() except Exception as e: print(">>>>>",e) I have done this simple thing to check the user custom permission but it rises the exception DoesNotExist('Permission matching query does not exist.') what's wrong in this ?? Continue reading...