How to create a CRUD REST API for all Django models with DRF?
up vote
0
down vote
favorite
How would one go about taking all models from all applications in django and then expose all of them under a systematic CRUD endpoint such as api/models/****
without writing DRF Views for each model individually? In other words, how does one create a generic CRUD API for all models of a django server to quickly modify data in the database via REST?
So if we have this application file structure
application/
/auth
/models
/token.py
/other_model.py
/shop
/profile
/...
It would result in the following CRUD endpoints
domain.com/api/models/auth/token
domain.com/api/models/auth/other_model
domain.com/api/models/shop/card
...
Further, these generic endpoints could allow basic filtering (by id, define return fields with a ?fields=...
parameter etc.
I know about Eve but we are committed to django/DRF and we want to cut away a lot of redundant model-serializer-view
verticals that offer little value for lots of code.
django rest django-rest-framework
add a comment |
up vote
0
down vote
favorite
How would one go about taking all models from all applications in django and then expose all of them under a systematic CRUD endpoint such as api/models/****
without writing DRF Views for each model individually? In other words, how does one create a generic CRUD API for all models of a django server to quickly modify data in the database via REST?
So if we have this application file structure
application/
/auth
/models
/token.py
/other_model.py
/shop
/profile
/...
It would result in the following CRUD endpoints
domain.com/api/models/auth/token
domain.com/api/models/auth/other_model
domain.com/api/models/shop/card
...
Further, these generic endpoints could allow basic filtering (by id, define return fields with a ?fields=...
parameter etc.
I know about Eve but we are committed to django/DRF and we want to cut away a lot of redundant model-serializer-view
verticals that offer little value for lots of code.
django rest django-rest-framework
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
How would one go about taking all models from all applications in django and then expose all of them under a systematic CRUD endpoint such as api/models/****
without writing DRF Views for each model individually? In other words, how does one create a generic CRUD API for all models of a django server to quickly modify data in the database via REST?
So if we have this application file structure
application/
/auth
/models
/token.py
/other_model.py
/shop
/profile
/...
It would result in the following CRUD endpoints
domain.com/api/models/auth/token
domain.com/api/models/auth/other_model
domain.com/api/models/shop/card
...
Further, these generic endpoints could allow basic filtering (by id, define return fields with a ?fields=...
parameter etc.
I know about Eve but we are committed to django/DRF and we want to cut away a lot of redundant model-serializer-view
verticals that offer little value for lots of code.
django rest django-rest-framework
How would one go about taking all models from all applications in django and then expose all of them under a systematic CRUD endpoint such as api/models/****
without writing DRF Views for each model individually? In other words, how does one create a generic CRUD API for all models of a django server to quickly modify data in the database via REST?
So if we have this application file structure
application/
/auth
/models
/token.py
/other_model.py
/shop
/profile
/...
It would result in the following CRUD endpoints
domain.com/api/models/auth/token
domain.com/api/models/auth/other_model
domain.com/api/models/shop/card
...
Further, these generic endpoints could allow basic filtering (by id, define return fields with a ?fields=...
parameter etc.
I know about Eve but we are committed to django/DRF and we want to cut away a lot of redundant model-serializer-view
verticals that offer little value for lots of code.
django rest django-rest-framework
django rest django-rest-framework
edited 4 hours ago
asked 6 hours ago
pascalwhoop
1,26011125
1,26011125
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371344%2fhow-to-create-a-crud-rest-api-for-all-django-models-with-drf%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown