On Fri, Jul 4, 2014 at 10:01 AM, William Granli <william.gra...@gmail.com> wrote: > I am trying to create a queryset for getting the values of a DateTimeField > which is DATETIME in the DB. > > The class in models.py: > > class ChangeMetrics(models.Model): > id = models.IntegerField(primary_key=True) > file_id = models.ForeignKey(File, db_column = 'file_id') > version_id = models.ForeignKey(Version, db_column = 'version_id') > function_id = models.ForeignKey(Function, blank=True, db_column = > 'function_id') > date = models.DateTimeField(blank=True, null=True) > user = models.TextField(blank=True) > changed = models.IntegerField(blank=True, null=True) > > The field in the SQL DB: > > date DATETIME > > The tuples are populated in the database and running SQL queries directly on > the DB is working perfectly. > > This is the queryset I am currently using in Django: > > queryset = ChangeMetrics.objects.filter(~Q(changed=None), ~Q(date=None), > ~Q(version_id=None))
Have you tried Q(date__isnull=False)? Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFHbX1%2BJgs5qdRJ4ECtWzcg_R%2BhVkxvv%3DM%3Dv%2BC2iUMgw_%3DWf-Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.