Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to edit polygon in django form #323

Open
OpenDataAlex opened this issue Apr 21, 2021 · 0 comments
Open

Unable to edit polygon in django form #323

OpenDataAlex opened this issue Apr 21, 2021 · 0 comments

Comments

@OpenDataAlex
Copy link

OpenDataAlex commented Apr 21, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant