Skip to content

Commit

Permalink
v6.7.0:增加了基本类,提高模型设计效率
Browse files Browse the repository at this point in the history
  • Loading branch information
Haoke98 committed Nov 2, 2023
1 parent aee4dde commit 86aa6d5
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 31 deletions.
64 changes: 34 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ Django 新的动态Admin , 具有异步请求, 异步列表页刷新和加载, U
* thinkPHP
* simpleUI
* simplePro
## Demo
* [数字化世界](https://github.com/Haoke98/AllKeeper)
## 使用方法
详细文档请见 [DjangoAsyncAdmin Docs](https://haoke98.github.io/DjangoAsyncAdmin/) .
* 详细文档请见 [DjangoAsyncAdmin Docs](https://haoke98.github.io/DjangoAsyncAdmin/) .
* SimplePro文档相见 [SimplePro Docs](https://www.mldoo.com/docs/simplepro/) .
### 1.安装
#### pip安装
```shell
Expand All @@ -35,35 +38,36 @@ pip install /path/to/your_project/dist/DjangoAsyncAdmin-6.5.4.tar.gz

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

## 密文转明文

| 目录 | 已转明文 | 备注 |
|-----------------|------|----------|
| bawa ||
| components ||
| editor ||
| group ||
| locale | |多种语言包目录,明文和二进制文件不需要处理
| management ||
| monitor ||
| static | |静态资源目录,不需要处理
| templates | |模版目录,不需要处理
| templatetags ||
| \_\_init\_\_.py ||
| action.py ||
| apps.py ||
| apps.py ||
| conf.py ||
| conf.py ||
| core.so | ✅ | 转化后保存到core.py中
| decorators.py ||
| dialog.py ||
| filters.py ||
| forms.py ||
| hanlers.py | ✅ | 去掉了加载core.so文件的部分,增加了 `from core.py import *`
| middlewares.py ||
| urls.py ||
| utils.py ||
## 目录结构说明

| 目录 | 备注 |
|-----------------|----------|
| bawa |
| components |
| editor |
| group |
| locale |多种语言包目录,明文和二进制文件不需要处理
| management |
| monitor |
| static |静态资源目录,不需要处理
| templates |模版目录,不需要处理
| templatetags |
| \_\_init\_\_.py |
| action.py |
| apps.py |
| apps.py |
| conf.py |
| conf.py |
| core.so | 转化后保存到core.py中
| decorators.py |
| dialog.py |
| filters.py |
| forms.py |
| hanlers.py | 去掉了加载core.so文件的部分,增加了 `from core.py import *`
| middlewares.py |
| models.py | 基本模型文件
| urls.py |
| utils.py |

## 新增功能日志
### 6.6.0
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "DjangoAsyncAdmin"
version = "6.6.0"
version = "6.7.0"
authors = [
{ name = "Sadam·Sadik", email = "[email protected]" },
]
Expand Down
26 changes: 26 additions & 0 deletions simplepro/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from django.db import models
from simplepro.editor import fields


class BaseModel(models.Model):
# id = models.IntegerField(primary_key=True, null=False, auto_created=True, editable=False)
createdAt = models.DateTimeField(auto_created=True, auto_now_add=True, verbose_name="创建时间", null=True,
editable=False, db_index=True)
updatedAt = models.DateTimeField(auto_now=True, verbose_name="最近更新时间", null=True, editable=False, db_index=True)
deletedAt = models.DateTimeField(verbose_name="被删除时间", null=True, editable=False, db_index=True)
info = fields.UETextField(verbose_name='说明', null=True, blank=True)

class Meta:
abstract = True
ordering = ['-updatedAt']


class BaseModelWithShowRate(BaseModel):
showTimes = models.IntegerField(verbose_name="被观看次数", default=0, editable=False)

def show(self):
self.showTimes += 1
self.save()

class Meta:
abstract = True

0 comments on commit 86aa6d5

Please sign in to comment.