Skip to content

Commit

Permalink
Protect against related field issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephane Poss committed Jun 12, 2024
1 parent 3b7cafe commit 29fea59
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gisserver/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def __init__(
self.model_field = None
self.parent = parent
self.abstract = abstract

self.related_field = False
# Allow to override the class attribute on 'self',
# which avoids having to subclass this field class as well.
if xsd_class is not None:
Expand Down Expand Up @@ -254,6 +254,7 @@ def bind(
)

field = field.related_model._meta.get_field(name)
self.related_field = True
self.model_field = field
else:
self.model_field = self.model._meta.get_field(self.name)
Expand Down Expand Up @@ -596,7 +597,7 @@ def _local_model_field_names(self) -> list[str]:
return [
(ff.model_field.name if ff.model_field else ff.model_attribute)
for ff in self.fields
if not ff.model_field.many_to_many and not ff.model_field.one_to_many
if not ff.model_field.many_to_many and not ff.model_field.one_to_many and not ff.related_field
]

@cached_property
Expand Down

0 comments on commit 29fea59

Please sign in to comment.