(model, table=Table, fields=None, exclude=None, localize=None)
return type(table)(class_name, (table,), table_class_attrs)
Return Table class for given `model`, equivalent to defining a custom table class::

        class MyTable(tables.Table):
            class Meta:
                model = model

    Arguments:
        model (`~django.db.models.Model`): Model associated with the new table
        table (`.Table`): Base Table class used to create the new one
        fields (list of str): Fields displayed in tables
        exclude (list of str): Fields exclude in tables
        localize (list of str): Fields to localize
Return Table class for given `model`, equivalent to defining a custom table class::
Return Table class for given model equivalent to defining a custom table class ::
def table_factory(model, table=Table, fields=None, exclude=None, localize=None):
    """
    Return Table class for given `model`, equivalent to defining a custom table class::

        class MyTable(tables.Table):
            class Meta:
                model = model

    Arguments:
        model (`~django.db.models.Model`): Model associated with the new table
        table (`.Table`): Base Table class used to create the new one
        fields (list of str): Fields displayed in tables
        exclude (list of str): Fields exclude in tables
        localize (list of str): Fields to localize
    """
    attrs = {"model": model}
    if fields is not None:
        attrs["fields"] = fields
    if exclude is not None:
        attrs["exclude"] = exclude
    if localize is not None:
        attrs["localize"] = localize
    # If parent form class already has an inner Meta, the Meta we're
    # creating needs to inherit from the parent's inner meta.
    parent = (table.Meta, object) if hasattr(table, "Meta") else (object,)
    Meta = type("Meta", parent, attrs)

    # Give this new table class a reasonable name.
    class_name = model.__name__ + "AutogeneratedTable"
    # Class attributes for the new table class.
    table_class_attrs = {"Meta": Meta}
    return type(table)(class_name, (table,), table_class_attrs)
def table_factory ( model , table = Table , fields = None , exclude = None , localize = None ) : attrs = { "model" : model } if fields is not None : attrs [ "fields" ] = fields if exclude is not None : attrs [ "exclude" ] = exclude if localize is not None : attrs [ "localize" ] = localize # If parent form class already has an inner Meta, the Meta we're # creating needs to inherit from the parent's inner meta. parent = ( table . Meta , object ) if hasattr ( table , "Meta" ) else ( object , ) Meta = type ( "Meta" , parent , attrs ) # Give this new table class a reasonable name. class_name = model . __name__ + "AutogeneratedTable" # Class attributes for the new table class. table_class_attrs = { "Meta" : Meta } return type ( table ) ( class_name , ( table , ) , table_class_attrs )