Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wuyue92tree committed Jul 5, 2023
1 parent 2455168 commit 155ce52
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 4 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 20 additions & 2 deletions docs/en/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ top menu,default is `[]`,will show nothing
> Tips: Top menu will not show icon,only support secondary menu max
## ModelAdmin
external ModelAdmin in django
### external ModelAdmin in django

- make table filter support `select2` in `change_list` page
- custom search field placeholder for `change_list` page
Expand All @@ -109,6 +109,24 @@ effect

![modeladmin](../assets/images/modeladmin.png)

### Custom Filters
#### DateRangeFilter

example:
```python title='rap/admin.py'
from adminlteui.admin import ModelAdmin
from adminlteui.filters import DateRangeFilter

class AutomationTaskRecordAdmin(CommonAdmin, ModelAdmin):
list_display = ('id', 'automation', 'account', 'status', 'start_time',
'end_time', 'update_time')
list_filter = ('automation__project', 'automation__source',
'status', ('start_time', DateRangeFilter), ('end_time', DateRangeFilter))

```
effect:
![adminlte_date_range_filter](../assets/images/adminlte_date_range_filter.png)

## Widgets

### AdminlteSelect
Expand Down Expand Up @@ -146,4 +164,4 @@ class CollectorAdmin(admin.ModelAdmin):
```
effect:

![adminlte_select](../assets/images/adminlte_select_multiple.png)
![adminlte_select_multiple](../assets/images/adminlte_select_multiple.png)
1 change: 1 addition & 0 deletions docs/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ INSTALLED_APPS = [
## Features

- [Custom General Option](/django-adminlte-ui/2.x/guide/#basic-info)
- [ModelAdmin](/django-adminlte-ui/2.x/guide/#modeladmin)
- [Widgets](/django-adminlte-ui/2.x/guide/#widgets)
- [Custom Menu](/django-adminlte-ui/2.x/guide/#menu)

Expand Down
24 changes: 22 additions & 2 deletions docs/zh/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class MyAdminlteConfig(AdminlteConfig):
> Tips: 顶部菜单将不显示Icon,并且最多显示二级菜单,多余的将被隐藏
## ModelAdmin
扩展django的ModelAdmin
### 扩展django的ModelAdmin

-`change_list`页面的table过滤器支持`select2`
- 自定义`change_list`页面搜索框的placeholder提示
Expand All @@ -109,6 +109,26 @@ class CollectorModelAdmin(ModelAdmin):

![modeladmin](../assets/images/modeladmin.png)

### Filters过滤器
#### DateRangeFilter

基于datarangepicker的时间范围过滤器

示例:
```python title='rap/admin.py'
from adminlteui.admin import ModelAdmin
from adminlteui.filters import DateRangeFilter

class AutomationTaskRecordAdmin(CommonAdmin, ModelAdmin):
list_display = ('id', 'automation', 'account', 'status', 'start_time',
'end_time', 'update_time')
list_filter = ('automation__project', 'automation__source',
'status', ('start_time', DateRangeFilter), ('end_time', DateRangeFilter))

```
效果图:
![adminlte_date_range_filter](../assets/images/adminlte_date_range_filter.png)

## Widgets组件

### AdminlteSelect
Expand Down Expand Up @@ -146,4 +166,4 @@ class CollectorAdmin(admin.ModelAdmin):
```
效果图:

![adminlte_select](../assets/images/adminlte_select_multiple.png)
![adminlte_select_multiple](../assets/images/adminlte_select_multiple.png)
1 change: 1 addition & 0 deletions docs/zh/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ INSTALLED_APPS = [
## 功能

- [自定义属性](/django-adminlte-ui/2.x/zh/guide/#_4)
- [ModelAdmin扩展](/django-adminlte-ui/2.x/zh/guide/#modeladmin)
- [Widget组件](/django-adminlte-ui/2.x/zh/guide/#widgets)
- [自定义菜单](/django-adminlte-ui/2.x/zh/guide/#_5)

Expand Down

0 comments on commit 155ce52

Please sign in to comment.