.. _customization: Custom pages and templates ========================== Datasette provides a number of ways of customizing the way data is displayed. CSS classes on the
~~~~~~~~~~~~~~~~~~~~~~~~~ Every default template includes CSS classes in the body designed to support custom styling. The index template (the top level page at ``/``) gets this: .. code-block:: html The database template (``/dbname``) gets this: .. code-block:: html The custom SQL template (``/dbname?sql=...``) gets this: .. code-block:: html A canned query template (``/dbname/queryname``) gets this: .. code-block:: html The table template (``/dbname/tablename``) gets: .. code-block:: html The row template (``/dbname/tablename/rowid``) gets: .. code-block:: html The ``db-x`` and ``table-x`` classes use the database or table names themselves if they are valid CSS identifiers. If they aren't, we strip any invalid characters out and append a 6 character md5 digest of the original name, in order to ensure that multiple tables which resolve to the same stripped character version still have different CSS classes. Some examples:: "simple" => "simple" "MixedCase" => "MixedCase" "-no-leading-hyphens" => "no-leading-hyphens-65bea6" "_no-leading-underscores" => "no-leading-underscores-b921bc" "no spaces" => "no-spaces-7088d7" "-" => "336d5e" "no $ characters" => "no--characters-59e024" ``id | name |
---|---|
1 | SMITH |