(self, *, raise_exception=False)
| 236 | content = serializers.CharField(required=False, label=_('content')) |
| 237 | |
| 238 | def is_valid(self, *, raise_exception=False): |
| 239 | super().is_valid(raise_exception=True) |
| 240 | workspace_id = self.data.get('workspace_id') |
| 241 | query_set = QuerySet(Knowledge).filter(id=self.data.get('knowledge_id')) |
| 242 | if workspace_id: |
| 243 | query_set = query_set.filter(workspace_id=workspace_id) |
| 244 | if not query_set.exists(): |
| 245 | raise AppApiException(500, _('Knowledge id does not exist')) |
| 246 | |
| 247 | def get_query_set(self): |
| 248 | self.is_valid() |
no test coverage detected