ExtractYear and ExtractMonth returning None in Django -
i trying group data on basis of year, month , column value. query is
feedbackdata.objects.annotate(year=extractyear('created'), month=extractmonth('created')).values('year','month','start_operator_alias').annotate(dcount=count('*')).values('year', 'month','start_operator_alias','dcount')
the result getting is:
<queryset [{'year': none, 'start_operator_alias': 7, 'dcount': 12858, 'month': none}, {'year': none, 'start_operator_alias': 2, 'dcount': 185042, 'month': none}, {'year': none, 'start_operator_alias': 5, 'dcount': 13963, 'month': none}, {'year': none, 'start_operator_alias': 3, 'dcount': 127819, 'month': none}, {'year': none, 'start_operator_alias': 0, 'dcount': 566040, 'month': none}, {'year': none, 'start_operator_alias': 6, 'dcount': 83877, 'month': none}, {'year': none, 'start_operator_alias': 1, 'dcount': 170064, 'month': none}, {'year': none, 'start_operator_alias': -1, 'dcount': 36550, 'month': none}, {'year': none, 'start_operator_alias': 4, 'dcount': 25714, 'month': none}, {'year': none, 'start_operator_alias': 8, 'dcount': 200, 'month': none}]>
as can see month , year returned none. can reason or doing wrong.
model: class feedbackdata(models.model): deviceid = models.charfield(blank=true, null=true, max_length=64, db_tablespace="indexes") start_cellid = models.charfield(null=true, blank=true, max_length=32) end_cellid = models.charfield(null=true, blank=true, max_length=32) start_mcc = models.charfield(null=true, blank=true, max_length=32) end_mcc = models.charfield(null=true, blank=true, max_length=32) start_mnc = models.charfield(null=true, blank=true, max_length=32) end_mnc = models.charfield(null=true, blank=true, max_length=32) start_lac = models.charfield(null=true, blank=true, max_length=32) end_lac = models.charfield(null=true, blank=true, max_length=32) start_operator_name = models.charfield(db_index=true, null=true, max_length=32, blank=true) start_operator_alias = models.integerfield(db_index=true, null=true, default=-1) end_operator_name = models.charfield(db_index=true, null=true, max_length=32, blank=true) end_operator_alias = models.integerfield(db_index=true, null=true, default=-1) start_signal_strength = models.charfield(null=true, blank=true, max_length=32) end_signal_strength = models.charfield(null=true, blank=true, max_length=32) average_signal_strength = models.charfield(null=true, blank=true, max_length=32) phone_type = models.charfield(db_index=true, null=true, blank=true, max_length=8, default='unknown') call_duration = models.integerfield(db_index=true, null=true, blank=true, default=0) network_type = models.charfield(db_index=true, null=true, blank=true, max_length=16, default='unknown') start_cell_signal_strength = models.charfield(null=true, blank=true, max_length=32) end_cell_signal_strength = models.charfield(null=true, blank=true, max_length=32) device_model = models.charfield(null=true, blank=true, max_length=64) device_manufacturer = models.charfield(db_index=true, null=true, blank=true, max_length=64) os_version = models.charfield(db_index=true, null=true, blank=true, max_length=32) start_time_of_call = models.datetimefield(blank=true, null=true) end_time_of_call = models.datetimefield(blank=true, null=true) start_lon = models.floatfield(db_index=true, null=true, blank=true) start_lat = models.floatfield(db_index=true, null=true, blank=true) end_lon = models.floatfield(db_index=true, null=true, blank=true) end_lat = models.floatfield(db_index=true, null=true, blank=true) start_lon_rad = models.floatfield(db_index=true, null=true, blank=true) start_lat_rad = models.floatfield(db_index=true, null=true, blank=true) end_lon_rad = models.floatfield(db_index=true, null=true, blank=true) end_lat_rad = models.floatfield(db_index=true, null=true, blank=true) start_cdma_lon = models.floatfield(db_index=true, null=true, blank=true) start_cdma_lat = models.floatfield(db_index=true, null=true, blank=true) end_cdma_lon = models.floatfield(db_index=true, null=true, blank=true) end_cdma_lat = models.floatfield(db_index=true, null=true, blank=true) rating_time = models.datetimefield(blank=true, null=true) speed = models.floatfield(null=true, blank=true) altitude = models.floatfield(null=true, blank=true) is_dual = models.booleanfield(db_index=true, default=false) is_roaming = models.booleanfield(db_index=true, default=false) is_network_roaming = models.booleanfield(default=false) call_drop = models.integerfield(db_index=true, null=true) rating = models.floatfield(db_index=true, null=true, blank=true) state_name = models.charfield(db_index=true, null=true, blank=true, max_length=255) additional_info = models.charfield(db_index=true, null=true, blank=true, max_length=216) comment = models.charfield(null=true, blank=true, max_length=512) in_out = models.integerfield(db_index=true, null=true) created = models.datetimefield(db_index=true, auto_now_add=true)
Comments
Post a Comment