| 1 | | Replying to [comment:1 Simon Charette]: |
| 2 | | > The reason why you can't filter against `GeometryType` is simply that this lookup have not been aded yet. |
| 3 | | > |
| 4 | | > In the mean time you could use the expression API to achieve the same thing without relying on `extra()`. |
| 5 | | > |
| 6 | | > {{{#!python |
| 7 | | > from django.db.models import CharField, Func |
| 8 | | > |
| 9 | | > class GeometryType(Func): |
| 10 | | > function = 'GeometryType' |
| 11 | | > output_field = CharField() |
| 12 | | > |
| 13 | | > LocationBorder.objects.annotate( |
| 14 | | > geom_type=GeometryType('geometry'), |
| 15 | | > ).filter( |
| 16 | | > geom_type__in={'POLYGON', 'MULTIPOLYGON'}, |
| 17 | | > ) |
| 18 | | > }}} |
| 19 | | |