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))
I have tried a raw query and also a version of the query that uses
exclude(), but that still returns None for date.
I am accessing the entries in the queryset through a for loop and simply
accessing date through entry.date inside the for loop.
I am using Django version 1.6.5. I have also tried getting the values
through the Django shell, to no success.
Any ideas on what could be wrong? I have tried a multitude of queries, none
of them change the returned value of date. I have tried resyncing the DB.
I've looked over the models and everything seems to be correct. Everything
except the date works fine.
--
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 [email protected].
To post to this group, send email to [email protected].
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/80ebbbe9-3a81-4feb-8d48-a9ccad8b1bd5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.