I am a starter in Django/Python.
I have a model MyModel
. It has many fields of datetime
, char
, integer
types. Now, I want a values list which has values of the datetime fields containing only the date parts.
I have tried using the dates function [reference] (https://docs.djangoproject.com/en/1.2/ref/models/querysets/#dates), but it works only with one field. I have multiple datetime fields and all have to be retrieved in the required format.
Basically, I want a Django equivalent of :
select stringfield1, date(datefield1), integerfield1, date(datefield2) from mymodel;
(PostGreSQL)
Is this even possible? If it is, how should I proceed further?