同时使用Django-admin和自定义用户特定的管理 [英] Using Django-admin and a custom user-specific admin concurrently

查看:266
本文介绍了同时使用Django-admin和自定义用户特定的管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个Django动力网站,将有许多应用程序(博客,商店,投资组合等),将由5个左右的人编辑,我已经远远地设计所有的Django管理员心神。

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.

我已经意识到,这是一个非常糟糕的思维方式 - 真的 - Django管理员应该只是顶级管理员,并应该用于正确的:管理网站,没有贡献。

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.

我写出了功能集,并意识到整个网站应用程序的数量(站点地图,邮件程序,联系人,评论,标签等)都是非常多的大于编辑器应该访问的功能数量(CRUD操作为博客/关于部分等)。

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).

更好的做法是建立一个基于Django管理员的复杂权限,或者建立一个第二个自定义编辑器管理员并发运行。

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)

推荐答案

我会争辩您应该建立一个单独的多样化管理应用程序。以下是我看到的利弊:

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

优点:


  1. 不需要篡改管理员或使用黑客来获取特定功能。我怀疑你需要几个这样的要求。

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

从管理员取消联机。虽然管理员非常有用,但是将应用程序与其紧密耦合是一个坏主意。更重要的是,如果你正在调整它。您将不得不注意管理员的任何更改将会破坏您的应用程序。

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.

自定义样式。我猜,您的列表中的视觉吸引力可能不高,但是比管理员应用程序更容易设计应用程序。

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.

将真正的超级用户与行管理员。只有权力用户才能看到您的系统内部的真实内部。

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

缺点:


  1. 你会重新发明车轮。通用视图使这更容易,但您仍然会最终复制功能或特征。

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

测试。管理应用程序被广泛使用,测试相当好。您可以使用它,而无需编写任何单元测试(大部分)。如果你建立自己的,你将不得不在其周围建立一个广泛的测试套件。

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.

这篇关于同时使用Django-admin和自定义用户特定的管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆