/usr/local/lib/python3.9/site-packages/django/contrib/gis/sitemaps/__pycache__
a Ӱ�h � @ s` d dl mZ d dlmZ d dlmZ d dlmZ d dlm Z G dd� de�Z G dd � d e �Zd S )� )�apps)� GeometryField)�Sitemap)�models)�reversec @ s@ e Zd ZdZdZddd�Zdd� Zdd d �Zdd� Zd d� Z dS )� KMLSitemapz1 A minimal hook to produce KML sitemaps. ZkmlNc C s | � |�| _d S �N)�_build_kml_sources� locations)�selfr � r �I/usr/local/lib/python3.9/site-packages/django/contrib/gis/sitemaps/kml.py�__init__ s zKMLSitemap.__init__c C s� g }|du rt �� }|D ]|}t|tjj�r^|jjD ](}t|t�r2|� |jj |jj|jf� q2qt|t tf�r�t|�dkr�td��|� |� qtd��q|S )z� Go through the given sources and return a 3-tuple of the application label, module name, and field name of every GeometryField encountered in the sources. If no sources are provided, then all models. N� z?Must specify a 3-tuple of (app_label, module_name, field_name).z)KML Sources must be a model or a 3-tuple.)r Z get_models� isinstancer �baseZ ModelBase�_meta�fieldsr �appendZ app_labelZ model_name�name�list�tuple�len� ValueError� TypeError)r �sourcesZkml_sources�source�fieldr r r r s* ��� zKMLSitemap._build_kml_sources� c C s* t j| |||d�}|D ]}| j|d<