diff options
author | 2020-12-02 13:12:45 +0200 | |
---|---|---|
committer | 2020-12-02 13:12:45 +0200 | |
commit | 6e7ea2a30c2e1290c90fde67257fb2052d5a8ad3 (patch) | |
tree | 31a902218235773f1cce80d010a8556eea13810d /backend | |
parent | Lock all forms showing to admins only (diff) |
Fix Question circular import and use cls instead self for validators
Diffstat (limited to 'backend')
-rw-r--r-- | backend/models/form.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/backend/models/form.py b/backend/models/form.py index d0f0a3c..79d1d54 100644 --- a/backend/models/form.py +++ b/backend/models/form.py @@ -3,7 +3,7 @@ import typing as t from pydantic import BaseModel, Field, validator from backend.constants import FormFeatures -from backend.models import Question +from .question import Question class Form(BaseModel): @@ -14,7 +14,7 @@ class Form(BaseModel): questions: t.List[Question] @validator("features") - def validate_features(self, value: t.List[str]) -> t.Optional[t.List[str]]: + def validate_features(cls, value: t.List[str]) -> t.Optional[t.List[str]]: """Validates is all features in allowed list.""" # Uppercase everything to avoid mixed case in DB value = [v.upper() for v in value] |