On Feb 12, 8:16 pm, Michael Elsdörfer <
elsdoer...@gmail.com> wrote:
> It works pretty much like Django models and forms do, i.e. a "creation
> counter" ensures that columns are in the order in which they have been
> defined (by default, Python stores class attributes as a dict which of
> course does not support ordering).
>
> Functionality to change the order *after* the table class or an
> instance has been created would certainly be possible, but I'm not
> sure yet how I feel about that.
>
> You do have a valid problem - the same problem one has right now with
> Form inheritance/ModelForms (and to a limited extend also with Models,
> though order there obviously doesn't matter all that match). I would
> like to stay true to the approach Django settles on - unfortunately,
> they don't seem to have yet. Related tickets include #5986 and #8164
> (*)
>
> In the meantime, the concept from this forms recipe can also be
> applied to django-tables and might help you along:
>
>
http://code.djangoproject.com/wiki/CookBookNewFormsFieldOrdering
>
> The columns are stored in a SortedDict, in "TableClass.base_columns"
> or "table_instance.columns._columns".
>