Problem with Automatic Spatial Transformations

I have followed Geodjango documentation, my PostGIS layer’s SRID is 32639 and when I use “geom__intersects” SRID change to 4326. This is my code:

    from django.contrib.gis.geos import GEOSGeometry
    polygon = GEOSGeometry('POLYGON((410501 4014861,410667 4015870,411099 4015637,410958 4014761,410501 4014861))', srid=32639)
    all_objects = BlkShahri.objects.filter(geom__intersects=polygon)

Result query is:

FROM "blk" 
WHERE ST_Intersects("blk"."geom", ST_Transform(ST_GeomFromEWKB('...'::bytea), 4326))

Can anyone to help me?

Could you please also provide your BlkShahri model definition?

Thanks for your reply. Yes of course, this is my BlkShahri model:

class BlkShahri(models.Model):
    gid = models.AutoField(primary_key=True)
    blk_no1395 = models.CharField(max_length=6, blank=True, null=True)
    value = models.FloatField(blank=True, null=True)
    taghir95ac = models.CharField(max_length=1, blank=True, null=True)
    adress1398 = models.CharField(max_length=19, blank=True, null=True)
    adres1398 = models.CharField(max_length=19, blank=True, null=True)
    taghir98 = models.CharField(max_length=200, blank=True, null=True)
    blk_no1398 = models.CharField(max_length=6, blank=True, null=True)
    adres1397 = models.CharField(max_length=19, blank=True, null=True)
    taghir97 = models.CharField(max_length=200, blank=True, null=True)
    layer = models.CharField(max_length=254, blank=True, null=True)
    path = models.CharField(max_length=254, blank=True, null=True)
    geom = models.MultiPolygonField(blank=True, null=True)

Thanks, then this confirms my suspicion, that you didn’t define any SRID in the geom field definition, and in this case, the default SRID is 4326. That explains why your query first cast your geometry to 4326 before using it to make spatial comparisons with database-stored geometries.