noirbizarre/django-eztables — pull request #29 by bernardotorres (2014-12-19 02:03:40+00:00)
Title: Enable use of @property's and callables in fields

Hi @noirbizarre and folks. This has also been a issue with me. I wanted to display data defined as `@property` and also transform the data to present it in a more pleasant way, with widgets, for example (in my specific case, I had a `Batch` object with a `printProgress` `@property` which I wanted to present as a progress bar.

So I made a patch.

This was the final result:

![bildschirmfoto 2014-12-18 um 23 48 25](https://cloud.githubusercontent.com/assets/1291350/5499120/740a7f48-8710-11e4-9ed8-3d2aa54a9f28.png)

This is how the DataTable was defined:

```
class BatchDatatablesView(DatatablesView):
model = Batch
fields = {
'client':'client__name',
'start':'start',
'quantity':'quantity',
'credential':'credential',
'progress':showProgress,
}
```

`credential` is a `@property` of `Batch`.

`showProgress` is a callable which takes the row (Django ORM single object) and returns a string to be displayed. In this case:

```
def showProgress(row):
return """

""" % row.printProgress
```

The present patch does not enable searching from properties or callables, but I don't think it would be a good idea anyway.

I'm opening a pull-request.