U
    {h                     @   sL   d dl mZ d dlmZ d dlmZ d dlmZ dd ZG dd deZ	d	S )
    )apps)ContentType)BaseCommand)ReferenceIndexc                 C   s   | j  d| j S )N.)
__module____name__)model r
   y/var/www/dating/data/www/fatepal.com/env/lib/python3.8/site-packages/wagtail/management/commands/show_references_index.py
model_name   s    r   c                   @   s   e Zd Zdd ZdS )Commandc                 K   s   | j d d}tt dd dD ]r}t|s4q$dd |g|j  D }|d }|d }tj	j
||d	 }| j |d
dt|  ||7 }q$| j d|  d S )NzReference index entries:r   c                 S   s   t | S )N)r   )mr
   r
   r   <lambda>       z Command.handle.<locals>.<lambda>)keyc                 S   s   g | ]}t jj|d dqS )F)Zfor_concrete_model)r   objectsZget_for_model).0Zmodel_or_objectr
   r
   r   
<listcomp>   s
    z"Command.handle.<locals>.<listcomp>)content_typebase_content_typez>6z  zTotal entries: )stdoutwritesortedr   Z
get_modelsr   Z
is_indexed_metaZget_parent_listr   filtercountr   )selfoptionsZobject_countr	   Zcontent_typesr   r   r   r
   r
   r   handle   s"    
 

zCommand.handleN)r   r   __qualname__r    r
   r
   r
   r   r      s   r   N)
Zdjango.appsr   Z"django.contrib.contenttypes.modelsr   Zdjango.core.management.baser   Zwagtail.modelsr   r   r   r
   r
   r
   r   <module>   s
   