Tuesday, 15 February 2011

python - How is data in a column changed in django-tables2? -



python - How is data in a column changed in django-tables2? -

i trying find way modify info displayed in django-tables2. in info have 2 columns "doi number" , "link". trying edit "doi number" column display

< href="link">doi number< /a>

so info within "doi number" column hyperlink.

the django-tables2 documentation shows code alter info within column. code doing? cannot figure out how supposed used modify data.

from django_tables2 import info = {"abc": {"one": {"two": "three"}}} a("abc.one.two").resolve(data)

django-tables2 documentation section http://django-tables2.readthedocs.org/en/latest/#specifying-alternative-data-for-a-column

by defining new columns info displayed can changed.

class tmntable(tables.table): new_column_name = tables.templatecolumn('<a href="{{model_name.url_id}}">{{model_name.text_to_display}}</a>') class meta: model = model_name fields = ('column_name', 'other_column_name', 'third_column_name', 'reference doi')

fields lists of columns display within table. other table types urlcolumn , linkcolumn , more info can found here http://django-tables2.readthedocs.org/en/latest/index.html#django_tables2.columns.booleancolumn

python django django-tables2

No comments:

Post a Comment