How to execute "Intersects" on two layers in Geodjango?

Hi,
I want to get all rows in layer1 than intersect with layer2. Can I do this?
Thanks.

Certainly, but we would need more information about your data structure to give you a proper answer. What are layer1 and layer2 in your case?

These are the codes of my models:

class Abadi(models.Model):
    gid = models.AutoField(primary_key=True)
    name = models.CharField(max_length=200, blank=True, null=True)
    geom = models.MultiPointField(blank=True, null=True, srid=32639) 

    class Meta:
        managed = False
        db_table = 'abadi'


class AbadiLimit(models.Model):
    gid = models.AutoField(primary_key=True)
    name = models.CharField(max_length=37, blank=True, null=True)
    address90 = models.CharField(max_length=30, blank=True, null=True)
    geom = models.MultiPolygonField(blank=True, null=True, srid=32639)  

    class Meta:
        managed = False
        db_table = 'abadi_limit'

I want to get records of “AbadiLimit” that intersect with “Abadi” layer.
Thanks in advance.

Basically, the general intersection query should look like:

abadi = Abadi.objects.get(name="SomeName")
AbadiLimit.objects.filter(geom__intersects=abadi.geom)

Now I’m unsure about database support (PostGIS or else) for ST_Intersects(MULTIPOLYGON, MULTIPOINT). To be tested…

I want to intersect multi point(from “Abadi” layer) with “AbadiLimit” but this code return just a record:

abadi = Abadi.objects.get(name="SomeName")

Raw SQL in PostGIG is like below code that works.

SELECT * 
FROM abadi, abadi_limit
WHERE ST_Intersects(abadi.geom, abadi_limit.geom);