# simple CheckConstraint syntax?

**URL:** <https://forum.djangoproject.com/t/simple-checkconstraint-syntax/4197>\
**Category:** Using Django\
**Created:** [September 5, 2020, 3:56am UTC](https://forum.djangoproject.com/t/simple-checkconstraint-syntax/4197 "2020-09-05T03:56:14Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [September 5, 2020, 4:09am UTC](https://forum.djangoproject.com/t/simple-checkconstraint-syntax/4197/2 "2020-09-05T04:09:31Z")

</div>

Your conditions in the constraint aren’t python expressions, they’re positional parameters being passed in to the Q object initializer. (Take a look at [Complex Lookups with Q objects](https://docs.djangoproject.com/en/3.1/topics/db/queries/#complex-lookups-with-q-objects).)  
Try:  
`~(models.Q(light=True) & models.Q(pigment=True))`  
or:  
`models.Q(light__ne=True) | models.Q(pigment__ne=True)`

---

_[View the full topic](https://forum.djangoproject.com/t/simple-checkconstraint-syntax/4197)._
