views:

37

answers:

2
| random_code         | varchar(200)  | YES  | UNI | NULL    |                |

MyTable.objects.filter(random_code = None)

Is this correct? Will this SELECT where there is no random code set? Above is my table.

+1  A: 

If you ever want to see what your QuerySet as SQL you can use QuerySet.query.as_sql() to return the SQL statement as a string.

Zach
A: 

This has been asked here. Basically you do this:

MyTable.objects.filter(random_code__isnull=True)
Jason Webb