azavea/OTM2 — pull request #1037 by ahinz (2014-01-21 21:12:36+00:00)
Title: Support UDFs and multi-table export

UDF fields cannot be used directly in a values query since they don't
resolve to valid field names.

However, django's 'extra' method helps us save it from itself. We can
manually pass in definitions for udf fields. For example:

```python
Plot.objects.values('id', 'udf:Owner')
```

Can be written as:

```python
extra_select={'udf:Owner': 'treemap_plot.udf->Owner'}
extra={'select': extra_select}

Plot.objects.extra(*extra).values('id', 'udf:Owner')
```

The `extra_select_and_values_for_model` generates these two pieces of
information (dict and field list) based on a given user's permissions

Fixes #1012
Fixes #1013