관리-도구
편집 파일: validation.cpython-38.pyc
U )�e- � @ sp d dl Z e jdkr d dlmZ nd dlmZ e jdk rDd dlmZ nd dlmZ d dlm Z G dd � d e�Z dS ) � N)� � )�BaseDatabaseValidation�r � )�models)�checks)� connectionc s0 e Zd Zejdk rdd� Zn� fdd�Z� ZS )�DatabaseValidationr c C sN t jt jt jf}t||�rJ|jdkrJ|jrJd}|�|||j|j j d� � dS )�� MySQL has the following field length restriction: No character (varchar) fields can have a length exceeding 255 characters if they have a unique index on them. � zY"%(name)s": %(cls)s cannot have a "max_length" greater than 255 when using "unique=True".)�name�clsN)r Z CharFieldZCommaSeparatedIntegerFieldZ SlugField� isinstance� max_length�unique�addr � __class__�__name__)�self�errors�opts�fZvarchar_fields�msg� r �v/opt/hc_python/lib64/python3.8/site-packages/../../../lib/python3.8/site-packages/mysql/connector/django/validation.py�validate_field s ��z!DatabaseValidation.validate_fieldc s~ t t| �j|f|�}t|dd�dkrz|�t�}|dkr:|S |�d�rz|jrz|jdksbt |j�dkrz|� tjdd|dd�� |S )r �relNZvarcharr zBMySQL does not allow unique CharFields to have a max_length > 255.z mysql.E001)�hint�obj�id) �superr �check_field�getattrZdb_typer � startswithr r �int�appendr �Error)r �field�kwargsr Z field_type�r r r r"