优化更新

This commit is contained in:
2026-09-13 17:33:13 +08:00
parent 8be23a62a3
commit 7f758cc6e9
97 changed files with 2333 additions and 3595 deletions
@@ -162,7 +162,7 @@ public/templates/
修改 `public/templates/models.py.tpl`:
```jinja2
```jinja
{% if f.type == 'CharField' %}
{{ f.name }} = models.CharField(
max_length={{ f.max_length or 255 }},
@@ -177,7 +177,7 @@ public/templates/
修改 `public/templates/services.py.tpl`,在添加方法中添加自定义校验:
```jinja2
```jinja
def add_{{ app_name }}(request):
# ... 原有代码 ...
# 自定义校验:检查名称是否重复
@@ -190,7 +190,7 @@ def add_{{ app_name }}(request):
修改 `public/templates/ui/columns.ts.tpl`:
```jinja2
```jinja
{% for f in list_fields %}
{
label: '{{ f.label }}',
@@ -208,7 +208,7 @@ def add_{{ app_name }}(request):
在 `public/templates/` 下新建 `test.py.tpl`:
```jinja2
```jinja
# tests/test_{{ app_name }}.py
from django.test import TestCase
from application.{{ app_name }}.models import {{ model_class_name }}
@@ -247,7 +247,7 @@ backend_templates = [
## Jinja2 语法速查
```jinja2
```jinja
{# 注释 #}
{# 变量输出 #}