1
- ![ Version] ( https://img.shields.io/badge/version-0.1.0 -orange.svg?style=for-the-badge&logo=semver )
1
+ ![ Version] ( https://img.shields.io/badge/version-0.1.1 -orange.svg?style=for-the-badge&logo=semver )
2
2
![ Python] ( https://img.shields.io/badge/python-3.11+-green.svg?style=for-the-badge&logo=python )
3
3
![ Django] ( https://img.shields.io/badge/django-5.0.2-green.svg?style=for-the-badge&logo=django )
4
4
[ ![ Ruff] ( https://img.shields.io/endpoint?style=for-the-badge&url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json )] ( https://github.com/astral-sh/ruff )
@@ -31,6 +31,16 @@ After **Django Admin List Filter**
31
31
32
32
---
33
33
34
+ ## 2024-07-03
35
+
36
+ Thanks to my dear friend [ Bahattin Çiniç] [ bahattincinic ] ’s warning, He realized
37
+ that the necessary HTML, CSS, and JavaScript files were missing from the
38
+ published package! I quickly fixed this and published a new version. The ` 0.1.0 `
39
+ version is a faulty version. I apologize to the users for this confusion.
40
+ Thank you. - vigo
41
+
42
+ ---
43
+
34
44
## Installation
35
45
36
46
``` bash
@@ -107,7 +117,7 @@ Example `admin.py`:
107
117
# admin.py
108
118
from dalf.admin import DALFModelAdmin, DALFRelatedOnlyField, DALFRelatedFieldAjax
109
119
from django.contrib import admin
110
-
120
+ from YOURAPP .models import Post
111
121
112
122
@admin.register (Post)
113
123
class PostAdmin (DALFModelAdmin ):
@@ -122,9 +132,27 @@ That’s all... There is also `DALFChoicesField`, you can test it out:
122
132
123
133
``` python
124
134
# admin.py
125
- from dalf.admin import DALFModelAdmin, DALFChoicesField, DALFRelatedOnlyField, DALFRelatedFieldAjax
126
135
from django.contrib import admin
136
+ from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
137
+ from django.contrib.auth.models import User
138
+
139
+ from dalf.admin import (
140
+ DALFModelAdmin,
141
+ DALFChoicesField,
142
+ DALFRelatedOnlyField,
143
+ DALFRelatedFieldAjax,
144
+ )
145
+
146
+ from YOURAPP .models import Post, Category, Tag
147
+
148
+ # must be registered, must have search_fields, required for `author` field demo.
149
+ # this is demo purpose only, you can register/import your own/custom User model
150
+ class UserAdmin (BaseUserAdmin ):
151
+ search_fields = [' username' ]
152
+ ordering = [' username' ]
127
153
154
+ admin.site.unregister(User)
155
+ admin.site.register(User, UserAdmin)
128
156
129
157
@admin.register (Post)
130
158
class PostAdmin (DALFModelAdmin ):
@@ -133,6 +161,20 @@ class PostAdmin(DALFModelAdmin):
133
161
(' category' , DALFRelatedFieldAjax), # enable ajax completion for category field (FK)
134
162
(' tags' , DALFRelatedOnlyField), # enable ajax completion for tags field (M2M) if posts has any tag!
135
163
)
164
+
165
+ # must be registered, must have search_fields
166
+ @admin.register (Category)
167
+ class CategoryAdmin (admin .ModelAdmin ):
168
+ search_fields = [' title' ,]
169
+ ordering = [' title' ]
170
+
171
+
172
+ # must be registered, must have search_fields
173
+ @admin.register (Tag)
174
+ class TagAdmin (admin .ModelAdmin ):
175
+ search_fields = [' name' ,]
176
+ ordering = [' name' ]
177
+
136
178
```
137
179
138
180
### Extras
@@ -148,6 +190,8 @@ Now add `timezone` field to `Post` model:
148
190
149
191
``` python
150
192
# modify models.py, add new ones
193
+ # ...
194
+
151
195
from timezone_field import TimeZoneField # <- add this line
152
196
153
197
class Post (models .Model ):
@@ -179,6 +223,7 @@ That’s it!
179
223
180
224
* [ Uğur Özyılmazel] ( https://github.com/vigo ) - Creator, maintainer
181
225
* [ Ehco] ( https://github.com/Ehco1996 ) - Contributor
226
+ * [ Bahattin Çiniç] [ bahattincinic ] - Bug Report!
182
227
183
228
---
184
229
@@ -203,6 +248,7 @@ pull requests!
203
248
Clone the repo somewhere, and install with:
204
249
205
250
``` bash
251
+ pip install -r requirements-dev.txt
206
252
pip install -e /path/to/dalf
207
253
pre-commit install
208
254
```
@@ -229,6 +275,10 @@ rake upload:test # Upload package to test distro
229
275
230
276
## Change Log
231
277
278
+ ** 2024-07-03**
279
+
280
+ - Now package is working fine :) Thanks to [ Bahattin] [ bahattincinic ] !
281
+
232
282
** 2024-06-01**
233
283
234
284
- Update missing information in the README
@@ -260,3 +310,4 @@ contributors are expected to adhere to the [code of conduct][coc].
260
310
[ 1 ] : https://github.com/demiroren-teknoloji/django-admin-autocomplete-list-filter " Deprecated, old package "
261
311
[ coc ] : https://github.com/vigo/django-admin-list-filter/blob/main/CODE_OF_CONDUCT.md
262
312
[ changelog ] : https://github.com/vigo/django-admin-list-filter/blob/main/CHANGELOG.md
313
+ [ bahattincinic ] : https://github.com/bahattincinic
0 commit comments