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 )
22![ Python] ( https://img.shields.io/badge/python-3.11+-green.svg?style=for-the-badge&logo=python )
33![ Django] ( https://img.shields.io/badge/django-5.0.2-green.svg?style=for-the-badge&logo=django )
44[ ![ 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**
3131
3232---
3333
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+
3444## Installation
3545
3646``` bash
@@ -107,7 +117,7 @@ Example `admin.py`:
107117# admin.py
108118from dalf.admin import DALFModelAdmin, DALFRelatedOnlyField, DALFRelatedFieldAjax
109119from django.contrib import admin
110-
120+ from YOURAPP .models import Post
111121
112122@admin.register (Post)
113123class PostAdmin (DALFModelAdmin ):
@@ -122,9 +132,27 @@ That’s all... There is also `DALFChoicesField`, you can test it out:
122132
123133``` python
124134# admin.py
125- from dalf.admin import DALFModelAdmin, DALFChoicesField, DALFRelatedOnlyField, DALFRelatedFieldAjax
126135from 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' ]
127153
154+ admin.site.unregister(User)
155+ admin.site.register(User, UserAdmin)
128156
129157@admin.register (Post)
130158class PostAdmin (DALFModelAdmin ):
@@ -133,6 +161,20 @@ class PostAdmin(DALFModelAdmin):
133161 (' category' , DALFRelatedFieldAjax), # enable ajax completion for category field (FK)
134162 (' tags' , DALFRelatedOnlyField), # enable ajax completion for tags field (M2M) if posts has any tag!
135163 )
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+
136178```
137179
138180### Extras
@@ -148,6 +190,8 @@ Now add `timezone` field to `Post` model:
148190
149191``` python
150192# modify models.py, add new ones
193+ # ...
194+
151195from timezone_field import TimeZoneField # <- add this line
152196
153197class Post (models .Model ):
@@ -179,6 +223,7 @@ That’s it!
179223
180224* [ Uğur Özyılmazel] ( https://github.com/vigo ) - Creator, maintainer
181225* [ Ehco] ( https://github.com/Ehco1996 ) - Contributor
226+ * [ Bahattin Çiniç] [ bahattincinic ] - Bug Report!
182227
183228---
184229
@@ -203,6 +248,7 @@ pull requests!
203248Clone the repo somewhere, and install with:
204249
205250``` bash
251+ pip install -r requirements-dev.txt
206252pip install -e /path/to/dalf
207253pre-commit install
208254```
@@ -229,6 +275,10 @@ rake upload:test # Upload package to test distro
229275
230276## Change Log
231277
278+ ** 2024-07-03**
279+
280+ - Now package is working fine :) Thanks to [ Bahattin] [ bahattincinic ] !
281+
232282** 2024-06-01**
233283
234284- Update missing information in the README
@@ -260,3 +310,4 @@ contributors are expected to adhere to the [code of conduct][coc].
260310[ 1 ] : https://github.com/demiroren-teknoloji/django-admin-autocomplete-list-filter " Deprecated, old package "
261311[ coc ] : https://github.com/vigo/django-admin-list-filter/blob/main/CODE_OF_CONDUCT.md
262312[ changelog ] : https://github.com/vigo/django-admin-list-filter/blob/main/CHANGELOG.md
313+ [ bahattincinic ] : https://github.com/bahattincinic
0 commit comments