Skip to content

Commit 86aa6d5

Browse files
committed
v6.7.0:增加了基本类,提高模型设计效率
1 parent aee4dde commit 86aa6d5

File tree

3 files changed

+61
-31
lines changed

3 files changed

+61
-31
lines changed

README.md

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ Django 新的动态Admin , 具有异步请求, 异步列表页刷新和加载, U
88
* thinkPHP
99
* simpleUI
1010
* simplePro
11+
## Demo
12+
* [数字化世界](https://github.com/Haoke98/AllKeeper)
1113
## 使用方法
12-
详细文档请见 [DjangoAsyncAdmin Docs](https://haoke98.github.io/DjangoAsyncAdmin/) .
14+
* 详细文档请见 [DjangoAsyncAdmin Docs](https://haoke98.github.io/DjangoAsyncAdmin/) .
15+
* SimplePro文档相见 [SimplePro Docs](https://www.mldoo.com/docs/simplepro/) .
1316
### 1.安装
1417
#### pip安装
1518
```shell
@@ -35,35 +38,36 @@ pip install /path/to/your_project/dist/DjangoAsyncAdmin-6.5.4.tar.gz
3538

3639
注意:⚠️ 其中`/path/to/your_project`转成你的项目路径(相对路径/绝对路径)
3740

38-
## 密文转明文
39-
40-
| 目录 | 已转明文 | 备注 |
41-
|-----------------|------|----------|
42-
| bawa ||
43-
| components ||
44-
| editor ||
45-
| group ||
46-
| locale | |多种语言包目录,明文和二进制文件不需要处理
47-
| management ||
48-
| monitor ||
49-
| static | |静态资源目录,不需要处理
50-
| templates | |模版目录,不需要处理
51-
| templatetags ||
52-
| \_\_init\_\_.py ||
53-
| action.py ||
54-
| apps.py ||
55-
| apps.py ||
56-
| conf.py ||
57-
| conf.py ||
58-
| core.so | ✅ | 转化后保存到core.py中
59-
| decorators.py ||
60-
| dialog.py ||
61-
| filters.py ||
62-
| forms.py ||
63-
| hanlers.py | ✅ | 去掉了加载core.so文件的部分,增加了 `from core.py import *`
64-
| middlewares.py ||
65-
| urls.py ||
66-
| utils.py ||
41+
## 目录结构说明
42+
43+
| 目录 | 备注 |
44+
|-----------------|----------|
45+
| bawa |
46+
| components |
47+
| editor |
48+
| group |
49+
| locale |多种语言包目录,明文和二进制文件不需要处理
50+
| management |
51+
| monitor |
52+
| static |静态资源目录,不需要处理
53+
| templates |模版目录,不需要处理
54+
| templatetags |
55+
| \_\_init\_\_.py |
56+
| action.py |
57+
| apps.py |
58+
| apps.py |
59+
| conf.py |
60+
| conf.py |
61+
| core.so | 转化后保存到core.py中
62+
| decorators.py |
63+
| dialog.py |
64+
| filters.py |
65+
| forms.py |
66+
| hanlers.py | 去掉了加载core.so文件的部分,增加了 `from core.py import *`
67+
| middlewares.py |
68+
| models.py | 基本模型文件
69+
| urls.py |
70+
| utils.py |
6771

6872
## 新增功能日志
6973
### 6.6.0

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "DjangoAsyncAdmin"
3-
version = "6.6.0"
3+
version = "6.7.0"
44
authors = [
55
{ name = "Sadam·Sadik", email = "1903249375@qq.com" },
66
]

simplepro/models.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from django.db import models
2+
from simplepro.editor import fields
3+
4+
5+
class BaseModel(models.Model):
6+
# id = models.IntegerField(primary_key=True, null=False, auto_created=True, editable=False)
7+
createdAt = models.DateTimeField(auto_created=True, auto_now_add=True, verbose_name="创建时间", null=True,
8+
editable=False, db_index=True)
9+
updatedAt = models.DateTimeField(auto_now=True, verbose_name="最近更新时间", null=True, editable=False, db_index=True)
10+
deletedAt = models.DateTimeField(verbose_name="被删除时间", null=True, editable=False, db_index=True)
11+
info = fields.UETextField(verbose_name='说明', null=True, blank=True)
12+
13+
class Meta:
14+
abstract = True
15+
ordering = ['-updatedAt']
16+
17+
18+
class BaseModelWithShowRate(BaseModel):
19+
showTimes = models.IntegerField(verbose_name="被观看次数", default=0, editable=False)
20+
21+
def show(self):
22+
self.showTimes += 1
23+
self.save()
24+
25+
class Meta:
26+
abstract = True

0 commit comments

Comments
 (0)