Skip to content

Commit 971202d

Browse files
committed
v0.8.1 release
1 parent 9a1ea70 commit 971202d

File tree

6 files changed

+85
-50
lines changed

6 files changed

+85
-50
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.8.1 (2020-12-09)
2+
3+
#### Bug Fixes
4+
5+
- 便于二次开发默认不再覆盖,
6+
17
## 0.8.0 (2020-12-01)
28

39
#### Bug Fixes

README.md

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -30,36 +30,6 @@ TyAdmin: 只需要花五分钟阅读README即可快速上手,无额外文档
3030
3131
前端页面,后端接口,路由,菜单全部自动对接,你只需要拷贝文档,修改配置,不需要写一行代码!!
3232

33-
🎁 内置
34-
35-
## 1. 多种登录方式
36-
37-
![](http://cdn.pic.mtianyan.cn/blog_img/20201130234228.png)
38-
39-
## 2. 内嵌自动dashboard,自动注册现有model count 数据。
40-
41-
![](http://cdn.pic.mtianyan.cn/blog_img/20201130234054.png)
42-
43-
## 3. 全自动的列表展示,增删改查, 筛选,搜索,导出Excel
44-
45-
![](http://cdn.pic.mtianyan.cn/blog_img/20201130234448.png)
46-
47-
![](http://cdn.pic.mtianyan.cn/blog_img/20201130234525.png)
48-
49-
## 4. django自带权限组支持,外键蓝点小标记pop支持
50-
51-
![](http://cdn.pic.mtianyan.cn/blog_img/20201130234705.png)
52-
53-
![](http://cdn.pic.mtianyan.cn/blog_img/20201130234753.png)
54-
55-
## 5. 基于Model定义的表单字段级别自动验证
56-
57-
![](http://cdn.pic.mtianyan.cn/blog_img/20201010194705.png)
58-
59-
## 6. 内嵌富文本支持,仅需把字段定义为`richTextField`,无需任何额外集成。
60-
61-
![](http://cdn.pic.mtianyan.cn/blog_img/20201010192630.png)
62-
6333
# 快速上手
6434

6535
>已有项目可从第二步开始,注意修改GEN_APPS 变量为自己需要生成的app列表
@@ -160,6 +130,38 @@ python manage.py runserver # 默认运行在8000端口
160130

161131
>如果没有成功看到页面,请查看QA部分
162132
133+
134+
🎁 内置
135+
136+
## 1. 多种登录方式
137+
138+
![](http://cdn.pic.mtianyan.cn/blog_img/20201130234228.png)
139+
140+
## 2. 内嵌自动dashboard,自动注册现有model count 数据。
141+
142+
![](http://cdn.pic.mtianyan.cn/blog_img/20201130234054.png)
143+
144+
## 3. 全自动的列表展示,增删改查, 筛选,搜索,导出Excel
145+
146+
![](http://cdn.pic.mtianyan.cn/blog_img/20201130234448.png)
147+
148+
![](http://cdn.pic.mtianyan.cn/blog_img/20201130234525.png)
149+
150+
## 4. django自带权限组支持,外键蓝点小标记pop支持
151+
152+
![](http://cdn.pic.mtianyan.cn/blog_img/20201130234705.png)
153+
154+
![](http://cdn.pic.mtianyan.cn/blog_img/20201130234753.png)
155+
156+
## 5. 基于Model定义的表单字段级别自动验证
157+
158+
![](http://cdn.pic.mtianyan.cn/blog_img/20201010194705.png)
159+
160+
## 6. 内嵌富文本支持,仅需把字段定义为`richTextField`,无需任何额外集成。
161+
162+
![](http://cdn.pic.mtianyan.cn/blog_img/20201010192630.png)
163+
164+
163165
# QA环节
164166

165167
## 0. `TemplateDoesNotExist at /xadmin/ TyAdmin/index.html`
@@ -200,7 +202,7 @@ re_path('media/(?P<path>.*)', serve, {"document_root": settings.MEDIA_ROOT}),
200202

201203
## 3. 当项目新增了model,我该如何为新model生成前端页面+后端接口
202204

203-
```
205+
```diff
204206
+TY_ADMIN_CONFIG = {
205207
+ 'GEN_APPS': ['demo','new_app']
206208
+}
@@ -221,6 +223,14 @@ npm run start:dev # 默认会运行在8001端口
221223

222224
请确认django运行在8000端口,访问http://127.0.0.1:8001/xadmin/
223225

226+
## 5. 如何更新tyadmin版本,强制覆盖上次生成
227+
228+
```
229+
TY_ADMIN_CONFIG = {
230+
'FORCED_COVER': True,
231+
}
232+
```
233+
224234
# 🤝 贡献者名单:
225235

226236
[longyn](https://github.com/longyn)

tyadmin_api_cli/antd_full_templates/src/layouts/UserLayout.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const UserLayout = props => {
5454
{
5555
key: 'TyAdmin',
5656
title: 'TyAdmin',
57-
href: 'https://pro.ant.design',
57+
href: 'https://github.com/mtianyan/tyadmin_api_cli',
5858
blankTarget: true,
5959
},
6060
{

tyadmin_api_cli/deal_antd_pages.py

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ def gen_antd_pages(project_name_settings, user_label_list, focus_model=None, tem
3838
from django.conf import settings
3939
if not user_label_list:
4040
user_label_list = settings.TY_ADMIN_CONFIG["GEN_APPS"]
41+
try:
42+
force_cover = settings.TY_ADMIN_CONFIG['FORCED_COVER']
43+
except KeyError:
44+
force_cover = False
4145
gen_labels = SYS_LABELS + user_label_list
4246
model_pic_dict = {}
4347
model_date_dict = {}
@@ -236,20 +240,37 @@ def gen_antd_pages(project_name_settings, user_label_list, focus_model=None, tem
236240
cur_path_co = f'{target_path}/{model_name}List/components'
237241
if not os.path.exists(cur_path_co):
238242
os.makedirs(cur_path_co)
239-
with open(f'{target_path}/{model_name}List/index.jsx', 'w', encoding='utf-8') as fw:
240-
fw.write(new_content)
241-
242-
with open(f'{target_path}/{model_name}List/service.js', 'w', encoding='utf-8') as fw:
243-
fw.write(new_services)
244-
245-
with open(f'{target_path}/{model_name}List/components/CreateForm.jsx', 'w', encoding='utf-8') as fw:
246-
fw.write(create_form)
247-
248-
with open(f'{target_path}/{model_name}List/components/UpdateForm.jsx', 'w', encoding='utf-8') as fw:
249-
fw.write(update_form)
243+
index_jsx_path = f'{target_path}/{model_name}List/index.jsx'
244+
if not force_cover and os.path.exists(index_jsx_path):
245+
pass
246+
else:
247+
with open(index_jsx_path, 'w', encoding='utf-8') as fw:
248+
fw.write(new_content)
249+
service_jsx_path = f'{target_path}/{model_name}List/service.js'
250+
if not force_cover and os.path.exists(service_jsx_path):
251+
pass
252+
else:
253+
with open(service_jsx_path, 'w', encoding='utf-8') as fw:
254+
fw.write(new_services)
255+
create_form_path = f'{target_path}/{model_name}List/components/CreateForm.jsx'
256+
if not force_cover and os.path.exists(create_form_path):
257+
pass
258+
else:
259+
with open(create_form_path, 'w', encoding='utf-8') as fw:
260+
fw.write(create_form)
261+
update_form_path = f'{target_path}/{model_name}List/components/UpdateForm.jsx'
262+
if not force_cover and os.path.exists(update_form_path):
263+
pass
264+
else:
265+
with open(update_form_path, 'w', encoding='utf-8') as fw:
266+
fw.write(update_form)
250267
if app_name == user._meta.app_label:
251-
with open(f'{target_path}/{model_name}List/components/UpdatePasswordForm.jsx', 'w', encoding='utf-8') as fw:
252-
fw.write(change_password_form)
268+
update_password_form_path = f'{target_path}/{model_name}List/components/UpdatePasswordForm.jsx'
269+
if not force_cover and os.path.exists(update_password_form_path):
270+
pass
271+
else:
272+
with open(update_password_form_path, 'w', encoding='utf-8') as fw:
273+
fw.write(change_password_form)
253274

254275

255276
if __name__ == '__main__':

tyadmin_api_cli/gen_url.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from tyadmin_api_cli.utils import init_django_env, get_lower_case_name
44
from tyadmin_api_cli.contants import SYS_LABELS
55

6+
67
def gen_url(project_name_settings, user_label_list):
78
init_django_env(project_name_settings)
89
import django

tyadmin_api_cli/gen_view.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from tyadmin_api_cli.utils import init_django_env, get_model_import_path
55
from tyadmin_api_cli.contants import SYS_LABELS
66

7+
78
def gen_view(project_name_settings, user_label_list):
89
init_django_env(project_name_settings)
910
import django
@@ -72,14 +73,10 @@ def get_serializer_class(self):
7273
else:
7374
return {model_name}CreateUpdateSerializer
7475
"""
75-
# if os.path.exists(f'{settings.BASE_DIR}/tyadmin_api/auto_views.py'):
76-
# print("已存在views跳过")
77-
# else:
7876
with open(f'{settings.BASE_DIR}/tyadmin_api/auto_views.py', 'w', encoding='utf-8') as fw:
7977
fw.write(viewset_txt)
8078

8179

8280
if __name__ == '__main__':
83-
# name = input("请输入项目settings位置:")
8481
name = "skyoms.settings"
85-
gen_view(name,None)
82+
gen_view(name, None)

0 commit comments

Comments
 (0)