outposts: fix error when getting component for base service connection

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-06-14 12:38:29 +02:00
parent 4e9be85353
commit 2580371f94
2 changed files with 8 additions and 1 deletions

View file

@ -33,6 +33,13 @@ class ServiceConnectionSerializer(ModelSerializer, MetaNameSerializer):
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:
model = OutpostServiceConnection

View file

@ -143,7 +143,7 @@ class OutpostServiceConnection(models.Model):
@property
def component(self) -> str:
"""Return component used to edit this object"""
return ""
raise NotImplementedError
class Meta: