You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have unmanaged model with geometry that I want to serve as MVT. Problem is that field name differs from table name.
class Obec(models.Model):
id = models.IntegerField(db_column="kod", primary_key=True)
name = models.CharField(max_length=255, db_column="nazev")
geom = models.MultiPolygonField(srid=5514)
okres_code = models.IntegerField(db_column="okres_kod")
class Meta:
managed = False
db_table = "g_obec_p"
I found that djangorestframework-mvt collects non geom columns and then in method _create_select_statement() calls self.only(*columns).query.sql_with_params()
And that's the problem. QuerySet method only works with fields not columns.
So in my case it ends with error:
raise FieldDoesNotExist("%s has no field named '%s'" % (self.object_name, field_name))
django.core.exceptions.FieldDoesNotExist: Obec has no field named 'orp_kod'
The text was updated successfully, but these errors were encountered:
Problem description
I have unmanaged model with geometry that I want to serve as MVT. Problem is that field name differs from table name.
I found that djangorestframework-mvt collects non geom columns and then in method _create_select_statement() calls self.only(*columns).query.sql_with_params()
And that's the problem. QuerySet method only works with fields not columns.
So in my case it ends with error:
The text was updated successfully, but these errors were encountered: