mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-23 05:10:57 +00:00
refactor: 重构代码结构并优化命名一致性
feat(backend): 新增模块示例和路径配置 fix(backend): 修复菜单模型名称唯一性约束 refactor(backend): 重构日志模块和路径配置 style(backend): 统一API方法命名规范 refactor(frontend): 重构API方法命名规范 fix(frontend): 修复权限校验问题 refactor: 移动定时任务测试文件到正确模块 docs: 更新模板文件路径 refactor: 优化日志记录和错误处理 fix: 修复排序默认值问题
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
{% for model_import in model_import_list %}
|
||||
{{ model_import }}
|
||||
{% endfor %}
|
||||
{% if table.sub %}
|
||||
from sqlalchemy.orm import relationship
|
||||
{% endif %}
|
||||
from typing import Optional
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.core.base_model import CreatorMixin
|
||||
|
||||
|
||||
class {{ class_name }}Model(CreatorMixin):
|
||||
"""
|
||||
{{ function_name }}表
|
||||
"""
|
||||
|
||||
__tablename__ = '{{ table_name }}'
|
||||
__table_args__ = {'comment': '{{ function_name }}'}
|
||||
__loader_options__ = ["creator"]
|
||||
|
||||
{% for column in columns %}
|
||||
{% if column.column_name not in ['id', 'creator_id', 'description', 'created_at', 'updated_at'] %}
|
||||
{{ column.column_name }}: Mapped[Optional[{{ column.python_type }}]] = mapped_column({{ column.column_type|get_sqlalchemy_type }}, {% if column.pk %}primary_key=True, {% endif %}{% if column.increment %}autoincrement=True, {% endif %}{% if column.required or column.pk %}nullable=False{% else %}nullable=True{% endif %}, comment='{{ column.column_comment }}')
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if table.sub %}
|
||||
{{ sub_class_name }}_list = relationship('{{ sub_class_name }}', back_populates='{{ business_name }}')
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user