Skip to content

How to set allow_mutation = False #238

Answered by collerek
jinserk asked this question in Q&A
Discussion options

You must be logged in to vote

As of now Config is generated for you (and will be overwritten even if you provide yours).
Used config is:

class Config(pydantic.BaseConfig):
    orm_mode = True
    validate_assignment = True

Config internally is stored in a model class under __config__ key so you can alter the settings this way:

class Mol(ormar.Model):
    ... # class declaration

Mol.__config__.allow_mutation = False

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jinserk
Comment options

Answer selected by collerek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants