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:
- django
- djangorestframework
- django-filter
install:
- pip install django_rest_admin
- add django app: in django project setttings.py file: INSTALLED_APPS list, add:
'rest_framework',
'django_filters',
'django_rest_admin',
- 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'
-
create admin user using command:
python manage.py createsuperuser -
start project using:
python manage.py runserver 0.0.0.0:8000
-
login to /admin/ in django_rest_admin --REST接口列表 --click button --生成RestAPI
-
add urls:
from django.urls import include
urlpatterns=[
path('api/', include ('myRestApiApp.urls')), #<<--add this line in the list
]
- finished!
use:
-
add table in your db: this could be down in navicat or some other db editors. of course you could coding in django,too.
-
open admin page: http://127.0.0.1/admin/
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
-
press RefreshRestAPI BUTTON in the list.
-
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84588e4ae4ce3d3ab3fad96a28f7c867be764fafe906151e9cee4f576a5efa96
|
|
| MD5 |
fa3b7a6d2788d3315ae7f106a7101b93
|
|
| BLAKE2b-256 |
dcda2c828ad254c0e4813ec2ae0db7c060f7c7c89b23c026dfc1469ca47e4ae4
|
File details
Details for the file django_rest_admin_plus-0.2.0-py3-none-any.whl.
File metadata
- Download URL: django_rest_admin_plus-0.2.0-py3-none-any.whl
- Upload date:
- Size: 449.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8884fcb2cdb7ba79a47166a993926e42de0afc62896211a9352d751553f6ec4c
|
|
| MD5 |
df00abdc1053ec0a6138174407b59820
|
|
| BLAKE2b-256 |
ef383c5dd7d220abcbea88f3c8f7ee2af0934586e75533fd503dbc5f34b927b3
|