queryproxy
Proxies representing the results of a query
-
class camelot.view.proxy.queryproxy.QueryTableProxy(admin, query_getter, columns_getter, max_number_of_rows=10, cache_collection_proxy=None)[source]
The QueryTableProxy contains a limited copy of the data in the SQLAlchemy
model, which is fetched from the database to be used as the model for a
QTableView
-
append(o)[source]
Add an object to this collection, used when inserting a new
row, overwrite this method for specific behaviour in subclasses
-
getData(*args, **kwargs)[source]
Generator for all the data queried by this proxy
-
get_collection()[source]
In case the collection is requested of a QueryProxy, we will return
a collection getter for a collection that reuses the data already queried by
the collection proxy, and available in the cache.
We do this to :
- Prevent an unneeded query when the collection is used to fetch an object already
fetched by the query proxy (eg when a form is opened on a table view)
- To make sure the index of an object in the query proxy is the same as the index
in the returned collection. Should we do the same query twice (once to fill the
query proxy, and once to fill the returned collection), the same object might appear
in a different row. eg when a form is opened in a table view, the form contains
another record than the selected row in the table.
-
setQuery(query_getter)[source]
Set the query and refresh the view
-
sort(column, order)[source]
Overwrites the QAbstractItemModel.sort() method