← Back
Editing: checks.cpython-311.pyc
� �|�e[� � �6 � d dl Z d dlmZ d dlmZ d dlmZ d dlmZm Z m Z d dlmZ d dl mZ d dlmZ d d lmZ d d lmZ d dlmZmZmZ d dlmZ d d lmZ d dlmZ d� Zd� Z d� Z!d� Z" G d� d� � Z# G d� de#� � Z$ G d� de#� � Z%d� Z&d� Z'd� Z(dS )� N)�chain)�apps)�settings)�NotRelationField�flatten�get_fields_from_path)�checks)�FieldDoesNotExist)�models)� LOOKUP_SEP)� Combinable)� BaseModelForm�BaseModelFormSet�_get_foreign_key)�engines)�DjangoTemplates)� import_stringc �F � t | |� � S # t $ r Y dS w xY w)zX issubclass() variant that doesn't raise an exception if cls isn't a class. F)� issubclass� TypeError)�cls� classinfos �=/usr/lib/python3/dist-packages/django/contrib/admin/checks.py�_issubclassr s9 � � ��#�y�)�)�)��� � � ��u�u����s � � � c � � t | � � }|D ]6} t |� � }n# t $ r Y �w xY wt ||� � r dS �7dS )z| Return whether or not a dotted class path (or a subclass of that class) is found in a list of candidate paths. TF)r �ImportErrorr )� class_path�candidate_pathsr �path� candidate_clss r �_contains_subclassr! ! sy � � � � #� #�C�� � �� �)�$�/�/�M�M��� � � ��H� ���� �}�c�*�*� ��4�4� ��5s �%� 2�2c �p � ddl m} g }|D ]*}|� |� | � � � � �+|S )Nr �� all_sites)�django.contrib.admin.sitesr$ �extend�check)�app_configs�kwargsr$ �errors�sites r �check_admin_appr, 2 sN � �4�4�4�4�4�4� �F�� /� /��� � �d�j�j��-�-�.�.�.�.��M� c �� � ddl m} t j d� � sg S g }d}|D ]H\ }}t j |� � s/|� t j d|z d|z �� � � � �It j � � D ] }t |t � � r |j } n�!d}|s*|� t j d d �� � � � n�d|j vrCt dt j � � r)|� t j d d�� � � � d|j vr)|� t j dd�� � � � t! d� |D � � � � }|r2d|j vr)|� t j dd�� � � � t dt j � � s)|� t j dd�� � � � t dt j � � s)|� t j dd�� � � � t dt j � � s*|� t j ddd� � � � � |S )!zF Check that the admin's dependencies are correctly installed. r r# zdjango.contrib.admin))zdjango.contrib.contenttypesi� )zdjango.contrib.authi� )zdjango.contrib.messagesi� zE'%s' must be in INSTALLED_APPS in order to use the admin application.z admin.E%d)�idNz�A 'django.template.backends.django.DjangoTemplates' instance must be configured in TEMPLATES in order to use the admin application.z admin.E403z+django.contrib.auth.context_processors.authz)django.contrib.auth.backends.ModelBackendz�'django.contrib.auth.context_processors.auth' must be enabled in DjangoTemplates (TEMPLATES) if using the default auth backend in order to use the admin application.z admin.E402z3django.contrib.messages.context_processors.messagesz�'django.contrib.messages.context_processors.messages' must be enabled in DjangoTemplates (TEMPLATES) in order to use the admin application.z admin.E404c 3 �$ K � | ]}|j V � �d S �N)�enable_nav_sidebar)�.0r+ s r � <genexpr>z%check_dependencies.<locals>.<genexpr>m s% � � � �L�L�$�d�5�L�L�L�L�L�Lr- z*django.template.context_processors.requestz�'django.template.context_processors.request' must be enabled in DjangoTemplates (TEMPLATES) in order to use the admin navigation sidebar.z admin.W411z7django.contrib.auth.middleware.AuthenticationMiddlewarezv'django.contrib.auth.middleware.AuthenticationMiddleware' must be in MIDDLEWARE in order to use the admin application.z admin.E408z4django.contrib.messages.middleware.MessageMiddlewarezs'django.contrib.messages.middleware.MessageMiddleware' must be in MIDDLEWARE in order to use the admin application.z admin.E409z4django.contrib.sessions.middleware.SessionMiddlewarezs'django.contrib.sessions.middleware.SessionMiddleware' must be in MIDDLEWARE in order to use the admin application.zInsert 'django.contrib.sessions.middleware.SessionMiddleware' before 'django.contrib.auth.middleware.AuthenticationMiddleware'.z admin.E410)�hintr/ )r% r$ r �is_installed�appendr �Errorr �all� isinstancer �engine�context_processorsr! r �AUTHENTICATION_BACKENDS�any�Warning� MIDDLEWARE) r) r$ r* �app_dependencies�app_name� error_coder; �django_templates_instance�sidebar_enableds r �check_dependenciesrF : s5 � � 5�4�4�4�4�4���3�4�4� �� � �F��� !1� � ���*�� ��*�*� ��M�M�&�,��!)�*���+�� � � � � �� �+�-�-� )� )���f�o�.�.� �(.� �%��E� � %)�!�$� !�� � �f�l� � � � � � � � � � :�0�C� D� D�"�#N�PX�Pp�q�q� D� �M�M�&�,�F� � � � � � � � B�0�C� D� D��M�M�&�,�)� � � � � � � � �L�L�)�L�L�L�L�L��� � L�0�C�!D� !D��M�M�&�.�&� � � � � � � � �W�Ya�Yl�m�m� �� � �f�l� F�� � � � � � � �T�V^�Vi�j�j� �� � �f�l� F�� � � � � � � �T�V^�Vi�j�j� �� � �f�l� F�M� � � � � � � � �Mr- c � � e Zd Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z d � Zd � Zd� Z d� Zd � Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� ZdS )�BaseModelAdminChecksc �( � g | � |� � �| � |� � �| � |� � �| � |� � �| � |� � �| � |� � �| � |� � �| � |� � �| � |� � �| � |� � �| � |� � �| � |� � �| � |� � �S r1 ) �_check_autocomplete_fields�_check_raw_id_fields� _check_fields�_check_fieldsets�_check_exclude�_check_form�_check_filter_vertical�_check_filter_horizontal�_check_radio_fields�_check_prepopulated_fields�_check_view_on_site_url�_check_ordering�_check_readonly_fields)�self� admin_objr) s r r'