Use .custom_sql() for _group_count implementation (refs #150)

pull/196/head
Simon Willison 2018-04-08 08:42:56 -07:00
rodzic 446d47fdb0
commit b2188f0442
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 17E2DEA2588B7F52
1 zmienionych plików z 1 dodań i 2 usunięć

Wyświetl plik

@ -644,13 +644,12 @@ class TableView(RowTableShared):
# _group_count=col1&_group_count=col2
group_count = special_args_lists.get('_group_count') or []
if group_count:
count_sql = None
sql = 'select {group_cols}, count(*) as "count" from {table_name} {where} group by {group_cols} order by "count" desc limit 100'.format(
group_cols=', '.join('"{}"'.format(group_count_col) for group_count_col in group_count),
table_name=escape_sqlite(table),
where=where_clause,
)
is_view = True
return await self.custom_sql(request, name, hash, sql, editable=True)
else:
count_sql = 'select count(*) from {table_name} {where}'.format(
table_name=escape_sqlite(table),