Skip to content

Commit 93530e0

Browse files
committed
fix: shared model edit error
1 parent 656c035 commit 93530e0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

apps/models_provider/serializers/model_serializer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def one(self, with_valid=False):
126126
if with_valid:
127127
super().is_valid(raise_exception=True)
128128
model = QuerySet(Model).get(
129-
id=self.data.get('id'), workspace_id=self.data.get('workspace_id')
129+
id=self.data.get('id'), workspace_id=self.data.get('workspace_id', 'None')
130130
)
131131
return ModelSerializer.model_to_dict(model)
132132

@@ -135,7 +135,7 @@ def one_meta(self, with_valid=False):
135135
if with_valid:
136136
super().is_valid(raise_exception=True)
137137
model = QuerySet(Model).filter(id=self.data.get("id"),
138-
workspace_id=self.data.get('workspace_id')).first()
138+
workspace_id=self.data.get('workspace_id', 'None')).first()
139139
if model is None:
140140
raise AppApiException(500, _('Model does not exist'))
141141
return {'id': str(model.id), 'provider': model.provider, 'name': model.name, 'model_type': model.model_type,
@@ -269,7 +269,7 @@ def is_valid(self, *, raise_exception=False):
269269
super().is_valid(raise_exception=True)
270270
if QuerySet(Model).filter(
271271
name=self.data.get('name'),
272-
workspace_id=self.data.get('workspace_id')
272+
workspace_id=self.data.get('workspace_id', 'None')
273273
).exists():
274274
raise AppApiException(
275275
500,

0 commit comments

Comments
 (0)