Порядок данных не из набора запросов в django-таблицах2
Документы говорят:
Where the table is backed by a model, the database will handle the ordering. Where this is not the case, the Python cmp function is used and the following mechanism is used as a fallback when comparing across different types: ...
Но возможно ли это в таблице, котораяis опираясь на модель, на пользовательский столбец? например
class MyModel(models.Model):
x = models.IntegerField()
y = models.IntegerField()
def z(self):
return x+y
class MyTable(tables.Table):
z = tables.Column()
class Meta:
model = MyModel
Когда я пытаюсь что-то вроде этого, столбец отображается ОК, но когда я нажимаю на заголовок столбца для сортировки, я получаю эту ошибку:
Caught FieldError while rendering: Cannot resolve keyword u'z' into field. Choices are: ...
По-видимому, это потому, что z не найден в таблице базы данных.
Это можно обойти?