我的 html 代码的药水做风格
<script type="text/javascript">
function our_Layers (map, options){
var datasets = new L.GeoJSON.AJAX("{% url 'owner' %}",{
style: function colors(feature){
switch(feature.properties.lr){
case "{{LR}}":
return{
color: 'red'
};
break
}
},
onEachFeature: function(feature, layer){
//layer.bindPopup(feature.properties.lr.toString());
layer.bindPopup('<strong>LR No.: </strong>'+ feature.properties.lr.toString()
);
}
});
datasets.addTo(map);
}
</script>
{% leaflet_map "parcels" callback="window.our_Layers" %}
我在 Django 中的看法
def Usermap(request):
plots1 = request.user.person.Persona.all()
for Registration in plots1:
LR=(Registration.parcels.lr)
context = {'plots':plots1,'LR':LR}
return render(request, 'Cadastre/Usermap.html', context)
已经在 django 中使用了那个 for 循环来向我展示可用的 lr,它们是 3,但我不能在传单函数中使用 django for 循环标签任何帮助