o
    ha                     @   sT   d dl mZ d dlmZ d dlmZ d dlmZ e ZdddZ	G d	d
 d
eZ
dS )    )ImproperlyConfigured)models)	Component)ModelFieldRegistryNFc                 C   s<   |du rt d|r| tjkrt dtj| |||d dS )a  
    Define how model field values should be rendered in the admin.
    The `display_class` should be a subclass of `wagtail.admin.ui.components.Component`
    that takes a single argument in its constructor: the value of the field.

    This is mainly useful for defining how fields are rendered in the inspect view,
    but it can also be used in other places, e.g. listing views.
    NzHregister_display_class must be passed a 'display_class' keyword argumentzOThe 'to' argument on register_display_class is only valid for ForeignKey fields)tovalueexact_class)r   r   
ForeignKeydisplay_class_registryregister)field_classr   display_classr    r   W/var/www/html/ndineBlogger/venv/lib/python3.10/site-packages/wagtail/admin/ui/fields.pyregister_display_class
   s   

r   c                   @   s   e Zd Zdd Zdd ZdS )BaseFieldDisplayc                 C   s
   || _ d S )Nr   )selfr   r   r   r   __init__$      
zBaseFieldDisplay.__init__c                 C   s
   d| j iS )Nr   r   )r   parent_contextr   r   r   get_context_data'   r   z!BaseFieldDisplay.get_context_dataN)__name__
__module____qualname__r   r   r   r   r   r   r   #   s    r   )NNF)django.core.exceptionsr   	django.dbr   wagtail.admin.ui.componentsr   wagtail.utils.registryr   r
   r   r   r   r   r   r   <module>   s    
