Pytigon's URL system builds on Django's URL dispatcher with automation and structure that eliminates manual URL configuration for standard CRUD operations.
When you define a model and configure views through the developer tools, Pytigon generates URL patterns automatically. The standard pattern is:
[app_name]/table/[TableName]/[base_filter]/[filter]/[target]/[view_type]/
| Segment | Purpose | Example |
|---|---|---|
app_name |
Django application name | tables_demo |
table/[TableName] |
Model/table identifier | table/Album |
base_filter |
Parent record filter (for sublists) | 3 (parent ID) |
filter |
Query filter string | active=true |
target |
Output format | pdf, xlsx, json |
view_type |
View type | list, edit, add, tree |
Pytigon's URL pattern uses regular expression matching:
r'((?P<base_filter>[\w=*,;-]*)/|)
(?P<filter>[\w=*,;-]*)/
(?P<target>[\w_-]*)/
[_]?(?P<vtype>list|sublist|tree|get|gettree|table_action)/$'
For views that don't fit the standard CRUD pattern, define URL patterns in [app]/urls.py:
from django.urls import path
from . import views
urlpatterns = [
path('custom-report/', views.CustomReportView.as_view(), name='custom_report'),
path('api/data/', views.api_data, name='api_data'),
]
| View Type | URL Pattern | Method |
|---|---|---|
| List | .../list/ |
GET |
| Sublist | .../sublist/ |
GET |
| Tree | .../tree/ |
GET |
| Get (single) | .../get/ |
GET |
| Add | .../[param]/add/ |
GET + POST |
| Edit | .../[id]/edit/ |
GET + POST |
| Delete | .../[id]/delete/ |
GET + POST |
| Table Action | .../table_action/ |
POST |
The target segment determines the output format:
| Target | Format | Content-Type |
|---|---|---|
| (empty/default) | HTML page | text/html |
pdf |
PDF document | application/pdf |
odf |
Open Document | application/vnd.oasis.opendocument.text |
xlsx |
Excel | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
json |
JSON | application/json |
txt |
Plain text | text/plain |
csv |
CSV | text/csv |
verXYZ |
HTML with suffix XYZ in template name | text/html |
Templates use Django's {% url %} tag for reverse URL resolution:
[a href="{% url 'myapp:album_list' %}"...View Albums]
[a href="{% url 'myapp:album_edit' object.id %}"...Edit Album]
Pytigon's href_action module provides additional URL manipulation tools for constructing complex navigation paths programmatically.
Pytigon supports subdomain/deployment path prefixes automatically. The context variable base_path is always available in templates for constructing absolute URLs: