Skip to content Skip to sidebar Skip to footer

Not Null Constraint Failed On Nested Serializer Due To "unable Do Get Repr For Queryset Class" Error

Trying to get basic Messaging functionality working in my DRF project. I seem to have a problem with the nested serializer validation. I'm new to DRF and have been reading the docs

Solution 1:

If you give null=True and blank=True options to your ForeignKeys, you will not get IntegrityError anymore. Since you haven't added null & blank options, Django ORM creates a constraint in your DB and will not let you to add empty values to your foreign keys. Django Model Field Reference


Post a Comment for "Not Null Constraint Failed On Nested Serializer Due To "unable Do Get Repr For Queryset Class" Error"