는 문서 말 :비의 검색어 데이터 순서는
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: ...
그러나 는 사용자 정의 열, 모델에 의해를 백업하는 테이블이 가능하다? 예 :
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는 발견되지 않기 때문에를 데이터베이스 테이블에서.
이 방법이 있습니까?
이것은 django-tables2의 버그/기능 부족입니다. http://github.com/bradleyayers/django-tables2/issues에 문제를 추가 하시겠습니까? 나는 최근에 이것을 깨뜨 렸지만 그것을 지키지 않았다. –
[이슈가 열렸습니다.] (https://github.com/bradleyayers/django-tables2/issues/82)하지만이 문제는 해결되지 않았습니다. –