Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 更改默认django用户模型时获取管理模板错误_Python_Django - Fatal编程技术网

Python 更改默认django用户模型时获取管理模板错误

Python 更改默认django用户模型时获取管理模板错误,python,django,Python,Django,您好,我在打开日志文件时收到此错误 我创建了一个自定义用户模型,让我的用户通过电子邮件登录。 我用谷歌搜索了这个日志中的一些错误,可能是已知的django bug,但我没有找到任何解决方案 Exception while resolving variable 'errors' in template 'admin/change_list.html'. Traceback (most recent call last): File "/Users/User/CODE/python/learn/

您好,我在打开日志文件时收到此错误 我创建了一个自定义用户模型,让我的用户通过电子邮件登录。 我用谷歌搜索了这个日志中的一些错误,可能是已知的django bug,但我没有找到任何解决方案

Exception while resolving variable 'errors' in template 'admin/change_list.html'.
Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 829, in _resolve_lookup
    current = current[bit]
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 837, in _resolve_lookup
    current = getattr(current, bit)
AttributeError: 'NoneType' object has no attribute 'errors'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 843, in _resolve_lookup
    current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'errors'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 850, in _resolve_lookup
    (bit, current))  # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [errors] in None
Exception while resolving variable 'show' in template 'admin/change_list.html'.
Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 829, in _resolve_lookup
    current = current[bit]
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/context.py", line 83, in __getitem__
    raise KeyError(key)
KeyError: 'show'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 835, in _resolve_lookup
    if isinstance(current, BaseContext) and getattr(type(current), bit):
AttributeError: type object 'RequestContext' has no attribute 'show'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 843, in _resolve_lookup
    current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'show'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 850, in _resolve_lookup
    (bit, current))  # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [show] in [{'True': True, 'False': False, 'None': None, 'csrf_token': <SimpleLazyObject: <function csrf.<locals>._get_val at 0x106d22ea0>>}]
(0.000) SELECT DISTINCT "custom_users_customuser"."email" FROM "custom_users_customuser" ORDER BY "custom_users_customuser"."email" ASC; args=()
Exception while resolving variable 'is_multipart' in template 'admin/change_list.html'.
Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 829, in _resolve_lookup
    current = current[bit]
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 837, in _resolve_lookup
    current = getattr(current, bit)
AttributeError: 'NoneType' object has no attribute 'is_multipart'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 843, in _resolve_lookup
    current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'is_multipart'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 850, in _resolve_lookup
    (bit, current))  # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [is_multipart] in None
Exception while resolving variable 'non_field_errors' in template 'admin/change_list.html'.
Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 829, in _resolve_lookup
    current = current[bit]
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 837, in _resolve_lookup
    current = getattr(current, bit)
AttributeError: 'NoneType' object has no attribute 'non_field_errors'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 843, in _resolve_lookup
    current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'non_field_errors'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 850, in _resolve_lookup
    (bit, current))  # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [non_field_errors] in None
Exception while resolving variable 'non_field_errors' in template 'admin/change_list.html'.
Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 829, in _resolve_lookup
    current = current[bit]
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 837, in _resolve_lookup
    current = getattr(current, bit)
AttributeError: 'NoneType' object has no attribute 'non_field_errors'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 843, in _resolve_lookup
    current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'non_field_errors'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/User/CODE/python/learn/django/venv/lib/python3.7/site-packages/django/template/base.py", line 850, in _resolve_lookup
    (bit, current))  # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [non_field_errors] in None
"GET /admin/custom_users/customuser/ HTTP/1.1" 200 6810
日志记录设置

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'console': {
            # exact format is not important, this is the minimum information
            'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
        },
    },
    'handlers': {
        'file': {
            'level': 'DEBUG',
            'class': 'logging.FileHandler',
            'filename': os.path.join(BASE_DIR, 'debug.log'),
        },
    },
    'loggers': {
        'django': {
            'handlers': ['file'],
            'level': 'DEBUG',
            'propagate': True,
        },
    },
}

在设置文件中,在“logger”中的“django”之后添加“django.template”,如下所示:

'loggers': {
    'django': {
        'handlers': ['file'],
        'level': 'DEBUG',
        'propagate': True,
    },
    'django.template': {
        'handlers': ['file'],
        'level': 'INFO',
        'propagate': True,
    },
}

这有什么用?谢谢,这帮帮忙!
'loggers': {
    'django': {
        'handlers': ['file'],
        'level': 'DEBUG',
        'propagate': True,
    },
    'django.template': {
        'handlers': ['file'],
        'level': 'INFO',
        'propagate': True,
    },
}