makinacorpus / django-leaflet

Use Leaflet in your Django projects
GNU Lesser General Public License v3.0
716 stars 282 forks source link

Polygon fill color not drawn #368

Closed ericel closed 1 year ago

ericel commented 1 year ago

My admin site draws the polygon just fine and fills in the colors as seen here:

Screenshot 2023-08-06 at 6 55 52 PM

Unfortunately, this is not true for a custom template. I get this:

Screenshot 2023-08-06 at 6 56 36 PM

Here is my form and template setup:

{% leaflet_css plugins="forms" %}
{% leaflet_js plugins="forms" %}
{% endblock %}

<form method="post">
    {% csrf_token %}
    {{ marketzoneform.as_p }}
    <button type="submit">Add Market Zone</button>
</form>```

### Form class is as below:
```class MarketZoneForm(forms.ModelForm):
    class Meta:
        model = MarketZone
        fields = ['name', 'description', 'geom']
        widgets = {'geom': LeafletWidget(attrs={'geom_type': "GEOMETRYCOLLECTION", 'display_raw': 'true'})}

settings.py:


INSTALLED_APPS = [
    ...
    'leaflet',
] ```
ericel commented 1 year ago

It was a SVG display problem