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.2.0.tar.gz (436.8 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.2.0-py3-none-any.whl (449.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_rest_admin_plus-0.2.0.tar.gz
  • Upload date:
  • Size: 436.8 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.2.0.tar.gz
Algorithm Hash digest
SHA256 84588e4ae4ce3d3ab3fad96a28f7c867be764fafe906151e9cee4f576a5efa96
MD5 fa3b7a6d2788d3315ae7f106a7101b93
BLAKE2b-256 dcda2c828ad254c0e4813ec2ae0db7c060f7c7c89b23c026dfc1469ca47e4ae4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_rest_admin_plus-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8884fcb2cdb7ba79a47166a993926e42de0afc62896211a9352d751553f6ec4c
MD5 df00abdc1053ec0a6138174407b59820
BLAKE2b-256 ef383c5dd7d220abcbea88f3c8f7ee2af0934586e75533fd503dbc5f34b927b3

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