Skip to main content

Expose django.contrib.admin as a restful service. useful for adding new features to django admin or writing a new admin.

Project description

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

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 🖼

browsable_api_root

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-api-admin-1.1.5.tar.gz (78.7 kB view details)

Uploaded Source

Built Distribution

django_api_admin-1.1.5-py3-none-any.whl (91.6 kB view details)

Uploaded Python 3

File details

Details for the file django-api-admin-1.1.5.tar.gz.

File metadata

  • Download URL: django-api-admin-1.1.5.tar.gz
  • Upload date:
  • Size: 78.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for django-api-admin-1.1.5.tar.gz
Algorithm Hash digest
SHA256 a96e2aff96712d185f00230148a25e4ebd82157ad41edc82511b9e18f3f85e12
MD5 ee47cf81f8e1e5e2a1868a3fe13c76ff
BLAKE2b-256 c2724ba3d007db1a5b1baa9765ba3d5fdc33d807f7e59abce852bda3bf879e90

See more details on using hashes here.

File details

Details for the file django_api_admin-1.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for django_api_admin-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 512d7335ed209e0bfdda7414ed0c125e81cf12b1b2d1305db59f26e932bd67e3
MD5 88c7a8e86af36fbb45790ad1f68b2236
BLAKE2b-256 7aa9389c9be2fcfc48f9094387ed213650dd986a888bf86e16e25e8315a5b06b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page