aboutsummaryrefslogtreecommitdiffstats
path: root/backend/models
diff options
context:
space:
mode:
authorGravatar Matteo Bertucci <[email protected]>2021-12-26 11:55:21 +0100
committerGravatar Matteo Bertucci <[email protected]>2021-12-26 11:55:21 +0100
commitf7f3e19e5ee0c2d8ec44399369648d7c22a0ac96 (patch)
tree9c99de084ef98baea5c57733fedc2d494fad43fe /backend/models
parentMerge pull request #120 from python-discord/jb3/store-correct-ip (diff)
Model: makes Form.id case insensitive
Note that it will make any existing form with an upper case letter impossible to access until its ID is changed, which shouldn't be the case in production according to @HassanAbouelela
Diffstat (limited to 'backend/models')
-rw-r--r--backend/models/form.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/backend/models/form.py b/backend/models/form.py
index 30ae0e7..f19ed85 100644
--- a/backend/models/form.py
+++ b/backend/models/form.py
@@ -1,7 +1,7 @@
import typing as t
import httpx
-from pydantic import BaseModel, Field, root_validator, validator
+from pydantic import constr, BaseModel, Field, root_validator, validator
from pydantic.error_wrappers import ErrorWrapper, ValidationError
from backend.constants import FormFeatures, WebHook
@@ -35,7 +35,7 @@ class _WebHook(BaseModel):
class Form(BaseModel):
"""Schema model for form."""
- id: str = Field(alias="_id")
+ id: constr(to_lower=True) = Field(alias="_id")
features: list[str]
questions: list[Question]
name: str