Checks only the model fields/fails with extra fields in the query set #8

Closed
atodorov opened this Issue Nov 5, 2012 · 0 comments

Comments

Projects
None yet
1 participant
Contributor

atodorov commented Nov 5, 2012

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.

atodorov closed this in a086261 Aug 9, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment