Skip to content
Snippets Groups Projects
Commit 20c2a811 authored by Simon Künzel's avatar Simon Künzel
Browse files

Fix id suffix for Any2Many fields

parent d99a61e5
Branches
No related tags found
No related merge requests found
......@@ -22,8 +22,6 @@ class ApiAbstractRelationshipField(ApiAbstractColumnField[_O], Generic[_O], ABC)
self._relationship: orm.Relationship or None = None
def post_init(self, context: FieldContext):
self.config_id = f"{self.member_name}_id"
super().post_init(context)
if not isinstance(context.own_member, orm.InstrumentedAttribute):
......@@ -57,6 +55,8 @@ class ApiMany2OneRelationshipField(ApiAbstractRelationshipField[_O], Generic[_O]
self._may_be_none = may_be_none
def post_init(self, context: FieldContext):
self.config_id = f"{self.member_name}_id"
if self.data_foreign_in_context and self.data_id is None and self.member_name is not None:
self.data_id = f"{self.member_name}_id"
......@@ -117,8 +117,10 @@ class ApiAny2ManyRelationshipField(ApiAbstractRelationshipField[_O], Generic[_O]
super().__init__(**kwargs)
def post_init(self, context: FieldContext):
self.config_id = f"{self.member_name}_ids"
if self.data_foreign_in_context and self.data_id is None and self.member_name is not None:
self.data_id = f"{self.member_name}_id"
self.data_id = f"{self.member_name}_ids"
super().post_init(context)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment