Skip to content Skip to sidebar Skip to footer
Showing posts with the label Validation

Context Manager To Validate Data

I'm trying to mull over a good solution to this and nothing is coming to mind. As an exercise, … Read more Context Manager To Validate Data

Unit Test Foreign Key Constraints In Django Models

I have 2 models defined, one of which is referenced to other via foreign key relation. I want to wr… Read more Unit Test Foreign Key Constraints In Django Models

Pydantic Does Not Validate When Assigning A Number To A String

When assigning an incorrect attribute to a Pydantic model field, no validation error occurs. from p… Read more Pydantic Does Not Validate When Assigning A Number To A String

Different Validation In Drf Serializer Per Request Method

Lets say i have a model like so: class MyModel(models.Model): first_field = models.CharField() … Read more Different Validation In Drf Serializer Per Request Method

Valueerror: Invalid Literal For Int() With Base 10 -- How To Guard Against Invalid User Input?

I made a program where the user enters a number, and the program would count up to that number and … Read more Valueerror: Invalid Literal For Int() With Base 10 -- How To Guard Against Invalid User Input?

How To Validate Complex List Types In Pydantic?

Why does pydantic not validate an argument that is the list of Foo objects but throws ValidationErr… Read more How To Validate Complex List Types In Pydantic?