OwlCyberSecurity - MANAGER
Edit File: questioner.cpython-39.pyc
a ���e4 � @ s� d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm Z d dl mZ d dlm Z ddlmZ G d d � d �ZG dd� de�ZG d d� de�ZdS )� N)�apps)� OutputWrapper)�NOT_PROVIDED)�timezone)�get_docs_version� )�MigrationLoaderc @ sZ e Zd ZdZddd�Zdd� Zdd� Zd d � Zdd� Zd d� Z dd� Z dd� Zdd� ZdS )�MigrationQuestionerz� Give the autodetector responses to questions it might have. This base class has a built-in noninteractive mode, but the interactive subclass is what the command-line arguments will use. Nc C s |pi | _ |pt� | _|| _d S )N)�defaults�set�specified_apps�dry_run)�selfr r r � r �`/home/gouroczh/virtualenv/pat/3.9/lib/python3.9/site-packages/django/db/migrations/questioner.py�__init__ s zMigrationQuestioner.__init__c C s� || j v rdS zt�|�}W n ty< | j�dd� Y S 0 t�|j�\}}|du rd| j�dd�S zt � |�}W n ty� | j�dd� Y S 0 t|dd�r�t �t j�|j��}n0t|d�r�t|j�dkr�dS t �t|j�d �}td d � |D �� S dS )z2Should we create an initial migration for the app?T�ask_initialFN�__file__�__path__r r c s s | ]}|d kr|� d�V qdS )z__init__.pyz.pyN)�endswith)�.0�xr r r � <genexpr>7 � z2MigrationQuestioner.ask_initial.<locals>.<genexpr>)r r Zget_app_config�LookupErrorr �getr �migrations_module�label� importlib� import_module�ImportError�getattr�os�listdir�path�dirnamer �hasattr�lenr �list�any)r � app_labelZ app_configZmigrations_import_path�_r � filenamesr r r r s( zMigrationQuestioner.ask_initialc C s dS )�#Adding a NOT NULL field to a model.Nr �r � field_name� model_namer r r �ask_not_null_addition9 s z)MigrationQuestioner.ask_not_null_additionc C s dS )�"Changing a NULL field to NOT NULL.Nr r. r r r �ask_not_null_alteration>