daa
django-api-admin
pypi i django-api-admin
daa

django-api-admin

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

by Muhammad Salah

1.0.2 (see all)License:MIT
pypi i django-api-admin
Readme

django-api-admin

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.
  • Provides data to dynamically create forms on clients from serializers.
  • Supports Arabic Language.
  • Extensively tested

Requirements 📄

Python 3.7+

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.

GitHub Stars

16

LAST COMMIT

1yr ago

MAINTAINERS

1

CONTRIBUTORS

2

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
1.0.2
1yr ago
1.0.1
1yr ago
1.0.0
1yr ago
No alternatives found
No tutorials found
Add a tutorial