fix(api): Dont try to access attribute if not exist in common viewset

ref: #761
This commit is contained in:
2025-05-15 22:34:12 +09:30
parent 900e03791a
commit edc7aedbe0
2 changed files with 7 additions and 8 deletions

View File

@ -87,9 +87,6 @@ class EntityModelTestCases(
yield
with django_db_blocker.unblock():
del request.cls.kwargs_create_item
@pytest.fixture( scope = 'class', autouse = True)

View File

@ -839,17 +839,19 @@ class SubModelViewSet(
is_nested_lookup = True
if(
if not hasattr(related_model, '_meta'):
related_model = None
elif(
str(
getattr(related_model, '._meta.sub_model_type', '')
getattr(related_model._meta, 'sub_model_type', '')
).lower().replace(' ', '_') == model_kwarg
):
break
else:
related_model = None
if related_model is None and not is_nested_lookup: