Skip to main content

Add your description here

Project description

django_rest_admin_plus

在django_rest_admin的基础上,解决外键仅支持sqlite3的问题,兼容mysql和postgresql

Adding table CRUD rest api with admin ui and without coding.

requirements:

  1. django
  2. djangorestframework
  3. django-filter

install:

  1. pip install django_rest_admin
  2. add django app: in django project setttings.py file: INSTALLED_APPS list, add:
    'rest_framework',
    'django_filters',
    'django_rest_admin',
  1. start restapi app(the app name can change by user):
 python manage.py startapp myRestApiApp

add myRestApiApp to INSTALLED_APPS:

    'myRestApiApp',

4 setings.py set apiapp write below in settings.py:

add this line in settings.py

DJANGO_REST_ADMIN_TO_APP='myRestApiApp'
  1. create admin user using command: python manage.py createsuperuser

  2. start project using:

python manage.py runserver 0.0.0.0:8000

  1. login to /admin/ in django_rest_admin --REST接口列表 --click button --生成RestAPI

  2. add urls:

from django.urls import include
urlpatterns=[
path('api/', include ('myRestApiApp.urls')), #<<--add this line in the list

]
  1. finished!

use:

  1. add table in your db: this could be down in navicat or some other db editors. of course you could coding in django,too.

  2. open admin page: http://127.0.0.1/admin/

    admin-page

    after login, their should be a table:Table-REST-CRUD. press Add.

    the option MUST be filled:

    A. route: the route name. eg: /Danwei
    B. Table big name: the model name of a table. eg: Danwei
    C. Table name: the table name. eg: danwei. ONLY needed if inspected_from_db=1
    D. Inspected from db: set to 1 if table is just from db, not from django model. otherwise set to 0.
    

    press Save

  3. press RefreshRestAPI BUTTON in the list.

  4. the django project will restart automaticly if you use debug mode. and then the rest api is generated already. press OpenApi button to test the api.

    admin-page

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_rest_admin_plus-0.1.0.tar.gz (436.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_rest_admin_plus-0.1.0-py3-none-any.whl (448.9 kB view details)

Uploaded Python 3

File details

Details for the file django_rest_admin_plus-0.1.0.tar.gz.

File metadata

  • Download URL: django_rest_admin_plus-0.1.0.tar.gz
  • Upload date:
  • Size: 436.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for django_rest_admin_plus-0.1.0.tar.gz
Algorithm Hash digest
SHA256 93eeed64ca4f6f7ffd64e7e82ca4135be955cda6c00d27532b8d87d4472f0ac7
MD5 5687d1559d7c6491215b26297a8ba96f
BLAKE2b-256 92306064c91bda39b94751cb6c5ea0efe56372aa67f47ff78ee213d6fb26c7a9

See more details on using hashes here.

File details

Details for the file django_rest_admin_plus-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_rest_admin_plus-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 305fc5ddd073f0e7f3e9fbc50d9d241f6cda5339ebf28f89cbed1cc39c4664fe
MD5 e5542f5fb6006d9f2018fca61d2691ff
BLAKE2b-256 8dc798289a385a43f6e8144819e8785cb34d9f6853aad84a2cd9ccac166e9253

See more details on using hashes here.

Supported by

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