Package hdg :: Package djangoapps :: Package admintable :: Module models :: Class AdminTable
[show private | hide private]
[frames | no frames]

Type AdminTable

object --+
         |
        AdminTable


AdminTable is main central object of the module. It connects DataSource with results data.
Method Summary
  __init__(self, data_source, **kwargs)
  add_action(self, label, link)
At the right side of table we usually have "Action" column.
  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.
  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.
  append_column_filter(self, column, filter, arg, module)
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.
  configured_filters(self)
Returns list of configured filtes, just their names from AdminTableConfig.name
  count(self)
Count amount of results.
  custom_controls(self)
Return full list of table controls for the current table'
  get_current_page(self)
Current rendered page
  get_extvars(self)
  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.
  has_next_page(self)
  has_previous_page(self)
  next_page_number(self)
  page_index(self)
Helper function for paginator - shows page range to choose
  pages(self)
Calculate amount of results pages.
  previous_page_number(self)
  process_request(self, request)
This method should be called from your view to process any user input.
  render(self)
Render table.
  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.
  rows(self)
This is actually the main method to fetch data.
  save_user_preferences(self, request)
Stores user preferences for current table object to session.
  searchable_field_names(self)
Returns list of searchable field names.
  searchable_fields(self)
Returns list of searchable fields.
  set_current_page(self, page)
Jump to page `page`
  set_extvars(self, extvars)
  set_name(self, name)
Set table name.
  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.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
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_page

Current rendered page
Get Method:
get_current_page(self)
Set Method:
set_current_page(self, page)

extvars

Get Method:
get_extvars(self)
Set Method:
set_extvars(self, extvars)

name

Returns this table name for reference
Get Method:
get_name(self)
Set Method:
set_name(self, name)

rows_per_page

Current setting of rows per page
Get Method:
get_rows_per_page(self)
Set Method:
set_rows_per_page(self, value)

sortable_columns

Returns list of sortable columns for table
Get Method:
get_sortable_columns(self)

Generated by Epydoc 2.1 on Tue May 26 10:42:08 2009 http://epydoc.sf.net