Django Admin 应用程序还是我自己的?

2022-01-25 00:00:00 python django django-admin

问题描述

我刚刚开始将 Django 用于个人项目.

I'm just starting to use Django for a personal project.

使用内置管理应用程序与将我的管理功能集成到应用程序本身(通过检查 request.user.is_staff)有什么优缺点?

What are the pros and cons of using the built-in Admin application versus integrating my administrative functions into the app itself (by checking request.user.is_staff)?

这是一个社区 wiki,因为它可以被视为投票.

This is a community wiki because it could be considered a poll.


解决方案

这真的取决于我猜的项目.虽然您可以在管理员中完成所有操作,但当您的应用程序变得更加复杂时,使用管理员也会变得更加复杂.如果您想让您的应用真正易于管理,您需要控制每一个小细节,而这对于管理应用来说是不可能的.

It really depends on the project I guess. While you can do everything in the admin, when your app gets more complex using the admin gets more complex too. And if you want to make your app really easy to manage you want control over every little detail, which is not really possible with the admin app.

我猜你应该是这样看的:

I guess you should see it like this:

使用 django admin:节省编写时间,浪费时间使用它.
滚动您自己的管理员:浪费时间编写它,节省使用它的时间.

Using django admin: save time writing it, lose time using it.
Rolling your own admin: lose time writing it, save time using it.

相关文章