outposts: fix error when getting component for base service connection
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
4e9be85353
commit
2580371f94
|
@ -33,6 +33,13 @@ class ServiceConnectionSerializer(ModelSerializer, MetaNameSerializer):
|
||||||
|
|
||||||
component = ReadOnlyField()
|
component = ReadOnlyField()
|
||||||
|
|
||||||
|
def get_component(self, obj: OutpostServiceConnection) -> str:
|
||||||
|
"""Get object type so that we know how to edit the object"""
|
||||||
|
# pyright: reportGeneralTypeIssues=false
|
||||||
|
if obj.__class__ == OutpostServiceConnection:
|
||||||
|
return ""
|
||||||
|
return obj.component
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
||||||
model = OutpostServiceConnection
|
model = OutpostServiceConnection
|
||||||
|
|
|
@ -143,7 +143,7 @@ class OutpostServiceConnection(models.Model):
|
||||||
@property
|
@property
|
||||||
def component(self) -> str:
|
def component(self) -> str:
|
||||||
"""Return component used to edit this object"""
|
"""Return component used to edit this object"""
|
||||||
return ""
|
raise NotImplementedError
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
||||||
|
|
Reference in New Issue