/usr/local/lib/python3.9/site-packages/django/contrib/auth/migrations/__pycache__
a Ӱ�h, � @ s` d dl Z d dlmZ d dlmZmZmZ d dlmZ dZ d dd�Z d d � ZG dd� dej�ZdS )� N)�color_style)�IntegrityError� migrations�transaction)�Qz� A problem arose migrating proxy model permissions for {old} to {new}. Permission(s) for {new} already existed. Codenames Q: {query} Ensure to audit ALL permissions for {old} and {new}. Fc sj t � }| �dd�}| �dd�}|jj}| �� D �]4}|j� � jsBq.� fdd�� jD �}t|d�} � j D ]\} }| t| |d�O } qf|j �|�}|j|d d �} |j|dd �}|r�|n| }|r�| n|}zPt j|d��. |j �|�j| |d �j|d � W d � n1 �s0 Y W q. t�yb d�|j|j�}d�|j|j�}tj�|�tj||| d��� Y q.0 q.dS )zk Update the content_type of proxy model permissions to use the ContentType of the proxy model. �auth� Permission�contenttypes�ContentTypec s g | ]}d |� j f �qS )z%s_%s)Z model_name)�.0�action��opts� �f/usr/local/lib/python3.9/site-packages/django/contrib/auth/migrations/0011_update_proxy_permissions.py� <listcomp> s z2update_proxy_model_permissions.<locals>.<listcomp>)Zcodename__in)�codename�nameT)Zfor_concrete_modelF)�using)�content_typeNz{}_{})�old�new�query)r Z get_model� connection�aliasZ get_models�_meta�proxyZdefault_permissionsr Zpermissions�objectsZ db_managerZ get_for_modelr Zatomicr �filter�updater �formatZ app_label�model�sys�stdout�write�WARNING)�apps� schema_editor�reverse�styler r r ZModelZ#proxy_default_permissions_codenamesZpermissions_queryr r Zcontent_type_managerZconcrete_content_typeZproxy_content_typeZold_content_typeZnew_content_typer r r r r �update_proxy_model_permissions sJ � ����*�r* c C s t | |dd� dS )zn Update the content_type of proxy model permissions to use the ContentType of the concrete model. T)r( N)r* )r&