[Answered ]-Correct way of writing a filter query on a geodjango model (finding out if a multipolygon field contains a point)

1👍

You separate the field name (here geom) and lookup (here __contains [Django-doc], with two consecutive underscores (__), not a single underscore, so:

from app_name.models import CountryBorder
from django.contrib.gis.geos import Point

pnt = Point(23.1827, 75.7682)

CountryBorder.objects.get(geom__contains=pnt)

Leave a comment