Using Django-admin and a custom user-specific admin concurrently

倖福魔咒の 提交于 2020-01-05 07:11:58

问题


I'm creating a Django powered website that will have numerous applications (Blog, Shop, Portfolio, etc.) that will be edited by 5 or so people, and I have so-far been designing everything with the Django admin in mind.

I have come to realise that this is a very bad way of thinking -as really- the Django admin should really only be for top level administrators, and should be used for exactly that: administrating the website, not contributing to it.

I wrote out the feature-set and realised that the number of applications the entire website should have (sitemaps,mailers,contactforms,comments,tags etc.)is much much larger than the number of features the editor should have access to (CRUD actions for blog/about section etc).

Is it better practice to build a complex permission based Django admin, or build a second custom "editors" admin to run concurrently.

I think this is something that should be discussed in the documentation, as until I realised this, I had a lot of trouble understanding how to break the website down into applications, as I was designing everything with the admin in mind (and what actual user should see in the admin)


回答1:


I'd argue that you should build a separate "diverse" admin app. Here are the pros and cons as I see them:

Pros:

  1. No need to tamper with Admin or use hacks to get specific features. I suspect you'll need several such given your requirements.

  2. De coupling from Admin. While Admin is very useful it is a bad idea to tightly couple your app with it. All the more so if you are tweaking it. Your would have to watch out for any changes in Admin that would break your app.

  3. Custom styling. I guess visual appeal may not be high on your list but it is far more easier to style your apps than the Admin app.

  4. Separate the really super users from "line admins". Let only the power users see the real innards of your system.

Cons:

  1. You'd be reinventing the wheel. Generic views make this easier but you'd still end up duplicating features or featurelets.

  2. Testing. The Admin app is widely used and is fairly well tested. You can use it without writing any unit tests (for most part). If you build your own you'll have to build an extensive test suite around it.




回答2:


It is a matter of opinion I think. But personally I prefer to create a separate admin and link a user group to that instead of using the main admin for both.

That way you can easily see how everything looks for the other users when there's a problem. It all depends on your situation though, so YMMV



来源:https://stackoverflow.com/questions/3821418/using-django-admin-and-a-custom-user-specific-admin-concurrently

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!