优化更新
This commit is contained in:
@@ -171,7 +171,7 @@ templates/
|
||||
|
||||
修改 `templates/models.py.tpl`:
|
||||
|
||||
```jinja2
|
||||
```jinja
|
||||
{% if f.db_type == 'String' %}
|
||||
{{ f.name }} = Column(String({{ f.db_args or 255 }}), nullable={{ 'True' if f.nullable else 'False' }}, index=True, comment="{{ f.comment }}")
|
||||
{% endif %}
|
||||
@@ -181,7 +181,7 @@ templates/
|
||||
|
||||
修改 `templates/service.py.tpl`,在 Service 类中添加钩子方法:
|
||||
|
||||
```jinja2
|
||||
```jinja
|
||||
class {{ model_class_name }}Service(BaseService):
|
||||
repository = {{ model_class_name }}Repository
|
||||
form = {{ model_class_name }}Form
|
||||
@@ -201,7 +201,7 @@ class {{ model_class_name }}Service(BaseService):
|
||||
|
||||
修改 `templates/ui/columns.ts.tpl`:
|
||||
|
||||
```jinja2
|
||||
```jinja
|
||||
{% for f in list_fields %}
|
||||
{
|
||||
label: '{{ f.label }}',
|
||||
@@ -219,7 +219,7 @@ class {{ model_class_name }}Service(BaseService):
|
||||
|
||||
在 `templates/` 下新建 `test.py.tpl`:
|
||||
|
||||
```jinja2
|
||||
```jinja
|
||||
# tests/test_{{ app_name }}.py
|
||||
import pytest
|
||||
from src.modules.{{ app_name }}.service import {{ app_name }}_service
|
||||
@@ -253,7 +253,7 @@ BACKEND_TEMPLATES = [
|
||||
|
||||
## Jinja2 语法速查
|
||||
|
||||
```jinja2
|
||||
```jinja
|
||||
{# 注释 #}
|
||||
|
||||
{# 变量输出 #}
|
||||
|
||||
@@ -133,7 +133,7 @@ git tag -l
|
||||
|
||||
## .gitignore 配置
|
||||
|
||||
```gitignore
|
||||
```ini
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
|
||||
Reference in New Issue
Block a user