Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/00-team/black-knight
custom django admin page
https://github.com/00-team/black-knight
admin admin-dashboard django react
Last synced: 4 months ago
JSON representation
custom django admin page
- Host: GitHub
- URL: https://github.com/00-team/black-knight
- Owner: 00-team
- License: gpl-3.0
- Created: 2022-04-22T18:51:05.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-26T16:02:14.000Z (over 2 years ago)
- Last Synced: 2024-09-27T16:40:49.375Z (4 months ago)
- Topics: admin, admin-dashboard, django, react
- Language: TypeScript
- Homepage:
- Size: 3.93 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# black knight
Django custom admin site
## Note
there are some major issue that are not easily fixable.\
if you want to use this library the best practice is to have both **djagno's default admin** and **black knight's admin** running side by side.> you can find the demo project in [demo](demo) directory
## install
`pip install black-knight`
## usage
create a new file in your main project directory\
`myproject/admin.py````py
# admin.pyfrom black_knight.admin import AdminSite
class KnightAdmin(AdminSite):
passknight = KnightAdmin()
```add black_knight in your installed apps\
`myproject/settings.py````py
# settings.pyINSTALLED_APPS = [
...
'black_knight',
...
]```
add new admin url in your urls.py\
`myproject/urls.py````py
# import your AdminSite instance
from myproject.admin import knighturlpatterns = [
...
path('admin/', knight.urls),
path('old-admin/', admin.site.urls),
...
]```
register your admins with the new `knight` as well.\
`myapp/admin.py````py
from black_knight.admin import ModelAdmin
from myproject.admin import knight
from django.contrib import adminfrom .models import MyModel
class MyModelAdmin(ModelAdmin):
passadmin.site.register(MyModel, MyModelAdmin)
knight.register(MyModel, MyModelAdmin)
```
you also need to change your `models.py`\
`myapp/models.py````diff
# replace all the models.XXXField with fields.XXXFieldfrom black_knight import fields
from django.db import modelsclass MyModel(models.Model):
+ title = fields.CharField(max_length=50)
- title = models.CharField(max_length=50)```