Skip to content

Unable to edit polygon in django form #323

@OpenDataAlex

Description

@OpenDataAlex

I've successfully installed django-leaflet into my app and can view/edit my polygon fields from the admin panel. I've been able to view but not edit the polygons in a normal django form.

My model:


class Location(models.Model):

    class Meta:
        db_table = "location"
        ordering = ['name']

    id = models.UUIDField(db_column="location_id", primary_key=True, default=uuid.uuid4, editable=False)
    name = models.CharField(db_column="location_name", null=False, max_length=750)
    drawn_area = models.PolygonField(db_column="location_drawn_area", null=False, srid=4326)

My form:


class LocationForm(forms.ModelForm):
    class Meta:
        model = Location
        fields = ['name', 'drawn_area']
        labels = {
            'name': 'Location Name',
            'drawn_area': 'Drawn Area'
        }
        widgets = {
            'drawn_area': LeafletWidget()
        }

When I click the edit layers button, I end up with:

https://imgur.com/a/VmKRhrq

I'm not sure what I'm doing wrong, or it's a bug, or something in between.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions