defoe
defoe

Reputation: 369

Using Django framework only with admin backend without any apps

I want to use Django only with admin backend without any apps. So actually all I want to do is to use the admin backend to CRUD my database. Now apparently the admin backend does not have a models.py and no views.py.

Do I really need the models.py from an app, or can I easily use only the admin backend to CRUD my database. How would I do this, add a models.py to the admin backend?

Upvotes: 0

Views: 423

Answers (1)

wcosta
wcosta

Reputation: 109

First of all, if you want to CRUD something, you will need a model so you can interact with your database (SQLite, Postgres, etc).

However, a model belongs to an app, once this is the core of Django. So, take a look at https://docs.djangoproject.com/en/2.2/topics/db/models/ where you can read more about that.

If you need a tutorial, take a look at https://docs.djangoproject.com/en/2.1/intro/tutorial02/

In summary, yes, you need an app. However, you do not need a view, once there will be no router, I suppose. Just expose your model to the admin, for instance:

from django.contrib import admin

from .models import YourModel

admin.site.register(YourModel)

Hope it helps

Upvotes: 1

Related Questions