Skip to main content

A library for rendering HTML tables and Excel files from SQLAlchemy models.

Project description

https://ci.appveyor.com/api/projects/status/6s1886gojqi9c8h6?svg=true https://circleci.com/gh/level12/webgrid.svg?style=shield https://codecov.io/gh/level12/webgrid/branch/master/graph/badge.svg

Introduction

WebGrid is a datagrid library for Flask and other Python web frameworks designed to work with SQLAlchemy ORM entities.

Based on the configured grid, it will output an HTML table with sorting, filtering, and paging.

It also will export the grid to Excel.

For now, if you are interested in using it, you will need to see the source code and tests therein for example usage.

Features

Render Specifiers

The column is visible in renderers specified in render_in. render_in may be: - an iterable of strings - a string - a lambda which accepts the column instance and returns a string or iterable of strings render_in is overridden if visible is False.

Visiblity

The column is visible when visible is True. visible may be: - a boolean - a lambda which accepts the column instance and returns a boolean

Questions & Comments

Please visit: http://groups.google.com/group/blazelibs

Running the Tests

Make sure to include the --nologcapture flag to nosetests or else you will get failures when testing the logging features.

Current Status

Currently beta quality.

Translations

Message management

The setup.cfg file is configured to handle the standard message extraction commands.

To manage the messages in the webgrid_ta test application:

  • extract_messages

    setup.py extract_messages --input-dirs=webgrid_ta --mapping-file=webgrid_ta/i18n/babel.cfg --output-file=webgrid_ta/i18n/webgrid_ta.pot
  • init_catalog

    setup.py init_catalog --domain=webgrid_ta --input-file=webgrid_ta/i18n/webgrid_ta.pot --output-dir=webgrid_ta/i18n --locale=es
  • update_catalog

    setup.py update_catalog --domain=webgrid_ta --input-file=webgrid_ta/i18n/webgrid_ta.pot --output-dir=webgrid_ta/i18n
  • compile_catalog

    setup.py compile_catalog --domain=webgrid_ta --directory=webgrid_ta/i18n

Upgrading

Upgrading to v0.1.38

The i18n support added in v0.1.38 introduces a slight change which could affect existing installations, related to the handling of “table totals” labels.

In versions prior to v0.1.38, the word ‘Totals’ (ie, “Page Totals” or “Grand Totals”) was added by the renderers.HTML.table_totals method. Starting in v0.1.38, the word ‘Totals’ is added individually in the methods which call table_totals (currently renderers.HTML.table_pagetotals and renderers.HTML.table_grandtotals).

Installations which customize any of the renderers.HTML.table_totals, renderers.HTML.table_pagetotals, or renderers.HTML.table_grandtotals should review the changes to ensure proper functionality.

Changelog

0.2.0 released 2019-11-06

  • Add generic search box (turned on via enable_search) to search on filtered columns (3624b78)

  • Add visible boolean parameter on Column, allow that and render_in to support lambdas for evaluation at run time (0e3e125)

  • Fixed pagination styling (b16ddbf)

  • Turn multiselect UI on for applicable filters (b7744e7)

  • Resolved some deprecation warnings (104a865)

  • Added debug logging of queries to aid in profiling (d6eae60)

  • Updated pypi license declaraton to use SPDX identifier in the license field (cf59e68)

  • Added BSD 3-Clause license (fb4184d)

0.1.45 released 2019-09-04

  • Merge pull request #59 from level12/20-allow-list-render-in (e2a5e46)

  • Merge pull request #64 from level12/40-cleanup-url-filters (a269e1c)

0.1.44 released 2019-06-27

  • Add column and filter classes to support enum types (#60) (9838669)

0.1.43 released 2019-05-20

  • fix BC case for session load when the key loads no data (7e11993)

0.1.42 released 2019-05-13

  • Ensure session store maintains proper data type through load/save (#35) (e7c5bdf)

  • Known issues: backwards-compatibility error when session store has no data

0.1.41 released 2019-03-25

  • Fix warning from xlsxwriter when second column has a subtotal (05e0663)

0.1.40 released 2019-02-18

  • py3: Fix Deprecation Warning for Inspect Call (#53) (9c87cc4)

0.1.39 released 2019-01-03

  • Properly handle None in date filter “between” ops (4da6069)

0.1.38 released 2018-11-14

  • Add optional i18n support using morphi (3627e8f) NOTE: there is a slight change that could result in a behavioral change during upgrade! Please see the ‘Upgrading’ section in the readme for more information!

0.1.37 released 2018-09-10

  • XLSX formats are cached for performance

0.1.36 released 2018-08-09

  • Add test helper assert_rendered_xls_matches in webgrid.testing

  • Add support for XLSX, and CSV renderers - If you have xlsxwriter installed, xlsx export link will appear

  • DEPRECATED old export mechanism - If you are calling g.xls.as_response() please replace that with g.export_as_response() which will select the correct renderer and return the response correctly - If xlsx is enabled you will need to make this above change to enable xlsx exporting

0.1.35 released 2018-01-05

  • fix CSS collision in tr classes with Bootstrap

  • change multiselect to use body as the container for the multiselect list

0.1.34 released 2017-08-25

  • session_override GET arg added to allow patching additional operators into the session (rather than overriding session filters)

0.1.33 released 2017-06-13

  • limit XLS sheet names to 30 characters, per the Excel format limit

0.1.32 released 2017-06-09

  • corrected the results of Filter.is_active to account for default operation with no value

  • fixed formencode requirement for python 3

  • update options filter error to include class name

0.1.31 released 2016-11-03

  • corrected DateTimeFilter processing to avoid “invalid date” messages

0.1.30 released 2016-10-28

  • fixed problem with lambda default args being processed by the grid

0.1.29 released 2016-10-28

  • allow default operation passed to filter to be a callable

0.1.28 released 2016-10-13

  • fixed an additional regression in DateFilter and DateTimeFilter validation

0.1.27 released 2016-10-13

  • corrected DateFilter and DateTimeFilter operations for empty, not empty, and between

0.1.26 released 2016-10-03

  • update TextFilter to support case-insensitive operations for dialects like postgresql and sqlite

0.1.25 released 2016-09-12

  • various bug fixes in DateTimeFilter

  • introduce support for Arrow date objects in grid and date filters

0.1.24 released 2016-05-10

  • enhanced options for subtotals to include sum, avg, strings, and SQLAlchemy expressions

0.1.23 released 2016-04-18

  • change dependency to webhelpers2 from webhelpers

  • update to support new python-dateutil, including fix of old parsing exception

  • fix testing compatibility with Flask-SQLALchemy 2.1

  • fix testing dependencies problem in setup

  • support Python 3.4 and newer

0.1.22 released 2016-02-18

  • fix potential warnings for SQLAlchemy when sorting by a label instead of an SA expression

0.1.21 released 2016-02-18

  • bad release

0.1.20 released 2016-02-18

  • errant release, identical to 0.1.19

0.1.19 released 2016-02-16

  • fix edit/delete link display on large screens

0.1.18 released 2015-12-11

  • fix bugs related to default operations using no-input date filters

0.1.17 released 2015-12-04

  • add YesNoFilter and OptionsIntFilterBase helper

  • fix compatibility with SQLAlchemy 1.0.9 for tests to pass

  • add additional DateFilter operators

0.1.16 released 2015-10-15

  • fixed problem with possible date/datetime filter overflows

0.1.15 released 2015-07-02

  • add time column and filter

0.1.14 released 2015-05-11

  • fix problem where empty strings passed to set as a non-required value 2 causes validation error

0.1.13 released 2015-02-12

  • attempt to use column label for subtotaling if no SA expression is provided

  • allow callers to specify default arguments to filters

0.1.12 released 2014-11-18

  • allow filters to set additional html attributes on their table rows

0.1.11 released 2014-10-09

  • fixed setup to include only webgrid in install, without the test apps

0.1.10 released 2014-10-02

  • bug fix: hide_controls_box grid attribute used in rendering

0.1.9 released 2014-09-22

  • bug fix: corrected default_op processing on TextFilter

0.1.8 released 2014-09-22

  • enable default_op processing for all filter types

0.1.7 released 2014-09-18

  • BC break: replaced MultiSelect widget with multipleSelect plugin. Related JS and CSS must be included (available in webgrid static)

  • included missing images referenced by webgrid CSS

0.1.6 released 2014-08-22

  • updated filter tests to work with SA0.9

  • refactoring related to subtotaling feature

  • adjustments for SQLAlchemy 0.9+ (we now support 0.8+)

  • workaround for dateutils parsing bug

  • testing fixes

  • completed dev requirements list

  • fixed nose plugin bug, must not assume pathname case consistency (Windows)

  • added BlazeWeb adapter

  • xls_as_response now an adapter method, called by XLS renderer

  • render_template now an optional adapter method, falls back to Jinja2 call

0.1.5 released 2014-05-20

  • fix nose plugin setup to avoid warning message

  • fix javascript bug related to sorting & newer jQuery libraries

  • fix SA expression test to avoid boolean ambiguity

  • avoid accidental unicode to text conversion in filters

0.1.4 released 2014-05-18

  • fix string/unicode handling to avoid coercion of unicode to ascii

0.1.3 released 2014-05-18

  • adjust the way the Flask blueprint is created and registered

  • adjust route on blueprint so it has /static/… prefix for URL

0.1.0 - 0.1.2 released 2014-05-17

  • initial release

  • fix packaging issues (0.1.1)

  • adjust init so xlwt not required if not used

Project details


Release history Release notifications | RSS feed

This version

0.2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

WebGrid-0.2.0.tar.gz (99.5 kB view hashes)

Uploaded Source

Built Distribution

WebGrid-0.2.0-py3-none-any.whl (95.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page