[Answered ]-Get relative path in Django

1๐Ÿ‘

โœ…

I tried a different approach and it worked

{% for field in field_list %}

    {% with "../media/"|add:field.kml.name as fieldname %}       

        $(".search_area").append(new Option("{{ field.friendly_name }}")); //friendly name 

         var polygon = omnivore.kml('{% static fieldname %}', null, new L.GeoJSON(null, { //file url
            style: function() {
                return {
                    color: 'red',
                    transparent: true,
                    opacity: 1,
                    fillOpacity: 0.05
                }
            }
        }));

             kml_arr.push([polygon, '{% static fieldname %}']); //file url
    {% endwith %}

{% endfor %}
๐Ÿ‘คhaduki

Leave a comment