o af @s`ddlmZddlmZddlmZddlmZddlm Z GdddeZ Gdd d e Z d S) )apps) GeometryField)Sitemap)models)reversec@s@eZdZdZdZdddZddZdd d Zd d Zd dZ dS) KMLSitemapz1 A minimal hook to produce KML sitemaps. kmlNcCs|||_dSN)_build_kml_sources locations)selfr r A/usr/lib/python3/dist-packages/django/contrib/gis/sitemaps/kml.py__init__szKMLSitemap.__init__cCsg}|dur t}|D]=}t|tjjr/|jjD]}t|tr-| |jj |jj |j fqq t|t tfrFt|dkr@td| |q td|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. Nz?Must specify a 3-tuple of (app_label, module_name, field_name).z)KML Sources must be a model or a 3-tuple.)r get_models isinstancerbase ModelBase_metafieldsrappend app_label model_namenamelisttuplelen ValueError TypeError)r sources kml_sourcessourcefieldr r rr s&     zKMLSitemap._build_kml_sourcescCs*tj||||d}|D]}|j|d<q |S)z| This method is overridden so the appropriate `geo_format` attribute is placed on each URL element. )pagesiteprotocol geo_format)rget_urlsr()r r%r&r'urlsurlr r rr)-s zKMLSitemap.get_urlscCs|jSr )r )r r r ritems7szKMLSitemap.itemscCs&td|j|d|d|dddS)Nz$django.contrib.gis.sitemaps.views.%srr$)labelmodel field_name)kwargs)rr()r objr r rlocation:szKMLSitemap.locationr )r$NN) __name__ __module__ __qualname____doc__r(rr r)r,r3r r r rrs   rc@seZdZdZdS) KMZSitemapkmzN)r4r5r6r(r r r rr8Esr8N) django.appsrdjango.contrib.gis.db.modelsrdjango.contrib.sitemapsr django.dbr django.urlsrrr8r r r rs    =