a
    YÒOcœ  ã                   @   s.   d dl mZ ddlmZmZ G dd„ dƒZdS )é    )Úserializersé   )ÚfieldsÚserializer_fieldsc                       s   e Zd Z‡ fdd„Z‡  ZS )ÚCountryFieldMixinc                    sŽ   t ƒ  ||¡\}}t|tjƒr(|tjur0||fS |j|d< |d= |jsNt	j}n8tj
}t	jf i |¤Ž}d|i}dtj
jv r†t|jƒ|d< ||fS )NÚ	countriesÚchoicesÚchildÚ
max_length)ÚsuperÚbuild_standard_fieldÚ
isinstancer   ZCountryFieldr   ZChoiceFieldr   Zmultipler   Z	ListFieldZdefault_error_messagesÚlen)ÚselfÚ
field_nameZmodel_fieldZfield_classZfield_kwargsZchild_field©Ú	__class__© úS/var/www/html/gsl.tools/lib/python3.9/site-packages/django_countries/serializers.pyr      s$    ÿ
þü
z&CountryFieldMixin.build_standard_field)Ú__name__Ú
__module__Ú__qualname__r   Ú__classcell__r   r   r   r   r      s   r   N)Zrest_frameworkr   Ú r   r   r   r   r   r   r   Ú<module>   s   