The Views Editor connects your database tables to the outside world. A "view" in Pytigon isn't just a Python class — it's a complete configuration that bundles together: what data to show, how to show it, which URLs to expose, and what actions to allow.
Pytigon's generic views cover the most common patterns:
| View Type | Purpose | Template Used |
|---|---|---|
| List | Show multiple records in a table | [model]_list.html |
| Detail/Edit | Show or edit a single record | [model]_edit.html |
| Add | Create a new record | [model]_add.html |
| Delete | Confirm and delete a record | [model]_delete.html |
| Tree | Hierarchical list with expand/collapse | [model]_tree.html |
| Sublist | Nested list within a parent record | [model]_sublist.html |
| Action | Custom server-side action | Dynamic |
Through the Views Editor form, you configure:
Pytigon generates URL patterns following this structure:
[app_name]/table/[TableName]/ → List view
[app_name]/table/[TableName]/list/ → AJAX list data
[app_name]/table/[TableName]/[base_filter]/[filter]/[target]/[view_type]/
[app_name]/table/[TableName]/[id]/edit/ → Edit form
[app_name]/table/[TableName]/add/ → New record form
[app_name]/table/[TableName]/[id]/delete/ → Delete confirmation
[app_name]/table/[TableName]/action/[action_name]/ → Custom action
The target segment controls output format:
- No target = HTML
- pdf = PDF document
- xlsx = Excel spreadsheet
- json = JSON data
- odf = Open Document Format
- csv = CSV export
Custom actions can be defined for list views and row views:
Actions are defined in the view configuration and implemented as methods on the model class or the view class.
Every rendered view receives a rich context including:
title — Page title
filter — Active filter from URL
base_filter — Base filter from URL (parent record ID)
app_name — Current application name
table_name — Current table name
doc_type — Output format (html, pdf, xlsx, etc.)
form — Filter/search form instance
uuid — Unique ID for this rendering
readonly — True if in read-only mode
show_title_bar — Whether to show the title bar
Use these in your templates to build adaptive, context-aware interfaces.