Skip to content

Commit 6856da6

Browse files
committed
完善了文档
1 parent 9f6cd31 commit 6856da6

File tree

4 files changed

+56
-3
lines changed

4 files changed

+56
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ pip install /path/to/your_project/dist/DjangoAsyncAdmin-6.5.4.tar.gz
7777

7878
<tr>
7979
<td rowspan="2">6.7.1</td>
80-
<td colspan="2">增加了拥有复制和自动生成密码的表单字段模型. 可以通过 `from simplepro.components.forms import PasswordFormField` 来引入调用.</td>
80+
<td colspan="2">增加了拥有复制和自动生成密码的表单字段 PasswordFormField.</td>
8181
</tr>
8282
<tr>
83-
<td colspan="2"><img src="docs/static/截屏2023-11-15%2016.20.58.png"/></td>
83+
<td colspan="2"><img src="https://haoke98.github.io/DjangoAsyncAdmin/static/截屏2023-11-15%2016.20.58.png"/></td>
8484
</tr>
8585

8686

docs/components.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# 组件文档
2+
3+
继承于 [SimplePro组件文档](https://www.mldoo.com/docs/simplepro/widget/checkbox.html#%E5%A4%8D%E9%80%89%E6%A1%86%E7%BB%84%E4%BB%B6)
4+
5+
## 基础组件
6+
7+
## 表单组件
8+
9+
### 密码组件
10+
11+
继承自`froms.CharField`表单字段
12+
13+
#### 效果
14+
15+
![](static/截屏2023-11-15%2016.20.58.png)
16+
17+
#### 如何引入
18+
19+
```python
20+
from simplepro.components.forms import PasswordFormField
21+
```
22+
23+
#### 参数
24+
25+
| 参数名 | 类型 | 必须 | 默认值 | 说明 |
26+
|--------------|-----|-----|--------------------------------------------------------------------------|------------|
27+
| label | 字符串 | ☑️ | | 表单中的字段展示名称 |
28+
| required | 布尔值 | ☑️ | False | 是否必填 |
29+
| encryptByMd5 | 布尔值 | ☑️ | True | 是否要MD5加密 |
30+
| lenMin | 数字 | ☑️ | 6 | 最小长度 |
31+
| lenMax | 数字 | ☑️ | 48 | 最大长度 |
32+
| pattern | 字符串 | ☑️ | "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-$%&@+!" | 随机生成的可选字符集 |
33+
34+
其他参数都继承`forms.CharField`.
35+
36+
#### 示例
37+
38+
```python
39+
from django.forms import ModelForm
40+
from simplepro.components.forms import PasswordFormField
41+
42+
from .models import DbServiceUser
43+
44+
45+
class DbServiceUserForm(ModelForm):
46+
password = PasswordFormField(label="密码", required=False, encryptByMd5=False)
47+
48+
class Meta:
49+
model = DbServiceUser
50+
fields = ['owner', 'service', 'username', 'password', 'hasRootPriority']
51+
52+
```

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Django 新的动态Admin , 具有异步请求, 异步列表页刷新和加载, U
1212
* [数字化世界](https://github.com/Haoke98/AllKeeper)
1313

1414
## 使用方法
15-
* 详细文档请见 [DjangoAsyncAdmin Docs](https://haoke98.github.io/DjangoAsyncAdmin/) .
15+
* 组件文档 [DjangoAsyncAdmin Components Docs](https://haoke98.github.io/DjangoAsyncAdmin/components.html) .
1616
* SimplePro文档相见 [SimplePro Docs](https://www.mldoo.com/docs/simplepro/) .
1717

1818
### 1.安装

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ classifiers = [
1717
"Homepage" = "https://haoke98.github.io/DjangoAsyncAdmin/"
1818
"Bug Tracker" = "https://github.com/Haoke98/DjangoAsyncAdmin/issues"
1919
"Documentation" = "https://haoke98.github.io/DjangoAsyncAdmin/"
20+
"Components Docs" = "https://haoke98.github.io/DjangoAsyncAdmin/"
2021
"Demo" = "https://github.com/Haoke98/AllKeeper"
2122

2223
[build-system]

0 commit comments

Comments
 (0)