Model.__getattribute__ 
Where is the `TypeError` originating from? Can you include the full traceback?
 Actually I think I know what might be happening.

Try changing your `__getattribute__()` to `getattr`, e.g.

``` python
ExtensionData.select().order_by(getattr(DailyData, prop).desc()).limit(500).iterator()
```
 Thanks!

The following works as expected:

```
prop = 'nr_users'
datapoints = entry.data_entries.order_by(DailyData.date_scraped.desc()).limit(10)
data = data + [str(entry.__getattribute__(prop)) for entry in datapoints]
```

However the following does not work. I'm not sure if that is expected or not. But I expected it to work. Instead this returns `TypeError: expected 1 arguments, got 0`:

```
output = ExtensionData.select().join(DailyData).order_by(
        DailyData.__getattribute__(prop).desc()).limit(500).iterator()
```
