| Home | Trees | Index | Help |
|---|
| Package hdg :: Package djangoapps :: Package admintable :: Module models :: Class AdminTable |
|
object --+
|
AdminTable
| Method Summary | |
|---|---|
__init__(self,
data_source,
**kwargs)
| |
At the right side of table we usually have "Action" column. | |
This is helper function, so instead of inheriting/overriding GeneratedField every time we need an Action column, we can add it by calling this fuction. | |
Usually used to add GeneratedColumn, or to specify columns list for raw SQL query | |
'control' is a button above/below table, which affects the whole results set. | |
Appends filter function from module `module`. | |
Return list of column names | |
Returns list of all table columsn in format of name,label | |
List. | |
Returns list of configured filtes, just their names from AdminTableConfig.name | |
Count amount of results. | |
Return full list of table controls for the current table' | |
Current rendered page | |
get_extvars(self)
| |
Returns this table name for reference | |
Current setting of rows per page | |
Returns list of sortable columns for table | |
This function output should be included to every link on a page, so current table state is not lost. | |
Which variables should be transferred between page clicks. | |
has_next_page(self)
| |
has_previous_page(self)
| |
next_page_number(self)
| |
Helper function for paginator - shows page range to choose | |
Calculate amount of results pages. | |
previous_page_number(self)
| |
This method should be called from your view to process any user input. | |
Render table. | |
Django HttpResponse object for cases when table have direct response | |
Restore user preferences from configuration saved in database. | |
This is actually the main method to fetch data. | |
Stores user preferences for current table object to session. | |
Returns list of searchable field names. | |
Returns list of searchable fields. | |
Jump to page `page` | |
set_extvars(self,
extvars)
| |
Set table name. | |
Set rows per page | |
Specify list of column names to be shown. | |
Set sort on field | |
Reverse current sort | |
Only shown columns in format name,label | |
Returns unique Session ID for this table screen. | |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
| Property Summary | |
|---|---|
current_page: Current rendered page | |
extvars | |
name: Returns this table name for reference | |
rows_per_page: Current setting of rows per page | |
sortable_columns: Returns list of sortable columns for table | |
| Method Details |
|---|
add_action(self, label, link)At the right side of table we usually have "Action" column. `add_control` is used to add more actions. |
add_action_column(self)This is helper function, so instead of inheriting/overriding GeneratedField every time we need an Action column, we can add it by calling this fuction. See also: add_action() |
add_column(self, column)Usually used to add GeneratedColumn, or to specify columns list for raw SQL query |
add_control(self, url, title)'control' is a button above/below table, which affects the whole results set. The example of "Control" button would be the link to Django-admin list of same objects. |
append_column_filter(self, column, filter, arg, module='django.template.defaultfilters')Appends filter function from module `module`. |
column_names(self)Return list of column names |
columns(self)Returns list of all table columsn in format of name,label |
columns_metainfo(self)List. Every list item is dictionary: name, label, is_shown |
configured_filters(self)Returns list of configured filtes, just their names from AdminTableConfig.name |
count(self)Count amount of results. Applies search if not applied. |
custom_controls(self)Return full list of table controls for the current table' |
get_current_page(self)Current rendered page |
get_name(self)Returns this table name for reference |
get_rows_per_page(self)Current setting of rows per page |
get_sortable_columns(self)Returns list of sortable columns for table |
getvars(self)This function output should be included to every link on a page, so current table state is not lost. |
getvars_list(self)Which variables should be transferred between page clicks. |
page_index(self)Helper function for paginator - shows page range to choose |
pages(self)Calculate amount of results pages. |
process_request(self, request)This method should be called from your view to process any user input. Also please do necessary check: if table.has_direct_response: return table.response() for the cases when table have direct answer to user actions |
render(self)Render table. Called from template. |
response(self)Django HttpResponse object for cases when table have direct response |
restore_user_preferences(self, request)Restore user preferences from configuration saved in database. This function is called automatically during table.process_request call if 'restore' paramters is found.. |
rows(self)This is actually the main method to fetch data. It applies filter, counts results, fetches results for current page. Normally called from template. |
save_user_preferences(self, request)Stores user preferences for current table object to session. This function is called automatically during table.process_request call. |
searchable_field_names(self)Returns list of searchable field names. Used in filter.html to render fields list which user can choose to search on |
searchable_fields(self)Returns list of searchable fields. Field: db.models.field |
set_current_page(self, page)Jump to page `page` |
set_name(self, name)Set table name. This is required for the cases when we have multiple table objects on same screen |
set_rows_per_page(self, value)Set rows per page |
set_shown_columns(self, column_names)Specify list of column names to be shown. |
set_sort_on(self, field)Set sort on field |
set_sort_reverse(self, value)Reverse current sort |
shown_columns(self)Only shown columns in format name,label |
sid(self, request)Returns unique Session ID for this table screen. Purpose: you can open same table in different configurations in multiple browser windows and still be able to work: session keys don't override each other. |
| Property Details |
|---|
current_pageCurrent rendered page
|
extvars
|
nameReturns this table name for reference |
rows_per_pageCurrent setting of rows per page
|
sortable_columnsReturns list of sortable columns for table
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Tue May 26 10:42:08 2009 | http://epydoc.sf.net |