Checks only the model fields/fails with extra fields in the query set
atodorov opened this issue · 0 comments
atodorov commented
Hi,
I got this error:
chartit/validation.py" in _validate_field_lookup_term
32. % (terms[0], ', '.join(model_fields)))
Exception Type: APIInputError at /..../
Exception Value: Field 'added' does not exist. Valid lookups are comment, id, key, metric, milestone, when_added.
The relevant code is:
metricsdata = DataPool(
series= [{'options': { 'source': InternalTimedMetrics.objects.extra(select={'added': "DATE_FORMAT(when_added,'%Y-%m-%d')"}).filter(key=METRIC_APPS_ACTIVE) },
'terms': [ 'metric', 'added']
}
]
)
#Step 2: Create the Chart object
cht = Chart(
datasource = metricsdata,
series_options =
[{'options':{
'type': 'line',
'stacking': False},
'terms':{
'added': ['metric']
}}]
)
I'm trying to workaround the fact that datetime is not supported for X axis by converting the values to string right in the DB layer but your sanity checks got me.