Expose django.contrib.admin as a restful service. useful for adding new features to django admin or writing a new admin.
Features ⚡
- Expose all django.contrib.admin views as a restful api.
- Similar to django.contrib.admin.
- Customizable AdminSite and ModelAdmin.
- Supports InlineModelAdmins and bulk edits.
- Provides data to dynamically create forms on clients from serializers.
- Extensively tested
Demo 🚀
You can also test it in this demo that is hosted on replit. use these credentials to login
- username: admin
- password: password
Requirements 📄
Python 3.9+
This package depends on
- django-rest-framework
- django.contrib.admin
Installation 📲
Install django-api-admin package.
$ pip install django-api-admin
In your settings.py make sure you have django.contrib.admin and rest_framework in your installed apps. and add django_api_admin.
INSTALLED_APPS = [
'django.contrib.admin',
'rest_framework',
'django_api_admin',
]
Example 💡
1. create some models.
models.py
from django.db import models
class Author(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
class Book(models.Model):
title = models.CharField(max_length=100)
author = models.ForeignKey(Author, on_delete=models.CASCADE)
def __str__(self):
return self.title
2. register them using the admin site.
admin.py
from django_api_admin.sites import site
from .models import Author, Book
site.register(Author)
site.register(Book)
3. include admin urls.
urls.py
from django_api_admin.sites import site
urlpatterns = [
path('api_admin/', site.urls),
]
4. run your development server.
$ python manage.py runsever
visit your localhost to see the browsable api.
Screenshots 🖼
Release files for django-api-admin 1.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-api-admin-1.1.6.tar.gz | 22.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_api_admin-1.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:48.0 kB
Release files / django-api-admin-1.1.6.tar.gz
| Download URL | django-api-admin-1.1.6.tar.gz |
|---|---|
| Size | 22.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
04e581cd70bb79e3004f8632d580e874cc78c731c7bdc965fb94984f0dbb6cd6
|
|
BLAKE2b-256 checksum How to use checksums |
a29b42d33fd3a4574d9d9790bd68f6864335eae680353925678c30a47d42caf6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / django_api_admin-1.1.6-py3-none-any.whl
| Download URL | django_api_admin-1.1.6-py3-none-any.whl |
|---|---|
| Size | 25.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d9e8fc8acfb1415f614569e2fe0df2ed79d4bd690bd83069a54382da2f06f614
|
|
BLAKE2b-256 checksum How to use checksums |
9fac24dd7c0c5a7210d1ac5b15d3f4c59da00c1cd62786d63a8a6995308f85b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|