class MyTable TableView __urlmapper__ UrlManager avatar test __manager

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class MyTable(TableView):
__urlmapper__ = UrlManager('avatar.test')
__manager__ = ModelManager(Avatar)
static = TextColumn('Static', 'Hello World')
url = AttributeColumn('URL', 'url', sortable=True)
tid = AttributeColumn('ID', 'id', sortable=True)
def test1():
data = Avatar.objects.query
return render_to_response('test.html', {
'table_view': MyTable(data),
})
def test2():
data = Avatar.objects.query
table = MyTable(data)
table.sort_by = MyTable.url
table.sort_asc = 10
table.page = 2
table.page_size = 30
return render_to_response('test.html', {
'table_view': table,
})