From the django q documentation:
You can make statements of arbitrary complexity by combining Q objects with and and | operators and use brackets. In addition, Q objects can be nullified using the ~ operator, which allows you to combine a search that combines both a regular query and a negative (NOT) query:
Q(question__startswith='Who') | ~Q(pub_date__year=2005)
Therefore I would recommend
Record.objects.filter( Q(parameter__icontains="wd2") | ~Q(parameter__icontains="wd") )
David berger
source share