Compare django-columns and django-vertical-multi-columns

Click to view:

The source code for this comparison is in GitHub.


About the Comparison

Using the same incoming data, I built 2 Django views ...

Audrey's approach

  • The data is prepared in the view.
  • the data is passed to the template as a list of individual data elements.
  • The template uses a custom template tag provided in Audrey's package to display the data elements in colunms.

Susan's approach

  • A child class of one provided in Susan's package is instantiated in the view.
  • The data is prepared by overriding method get_data(self).
  • A method in the parent class creates a list of lists where the "inner" lists are composed of all the elements that should appear in each displayed row.
  • The template processes the data using a typical {% for row in rows %) ... {% endfor %} construct.
  • There are 3 options for building the columns. They can be built so:
    • Even - Each column in roughly the same length.
    • Criteria - Using passed methods you write, the columns contain the elements identified by those methods.
    • Defined - You pass the columns you want displayed as is.