Django admin 很难定制吗?
我已经用 Django Admin 玩了几天来探索它,但我仍然不知道如何按照我们需要的方式定制它。
每次我在管理面板中寻找自定义帮助时,我都会发现各种社区和论坛上的一堆文章,解释如何自定义模板、列表项、列视图等。但这应该不叫Django定制。
如果我需要对用户功能进行哪怕很小的更改或对身份验证模块进行任何修改。即使在弄清楚如何做到这一点上也需要付出很多努力。
Django 是否很难定制,或者它只是缺乏互联网上可用的帮助,或者是我在朝着错误的方向前进?
I have been playing for a couple of days with Django Admin to explore it, but I am still clueless of how it can be customized in the way we need.
Every time I look for any help for the customization in the admin panel, what I find is, a bunch of articles on various communities and forums, explaining how to customize the template, the lists items, the the column views etc. But that should not be called Django Customization.
If I need to make even a small change in the User functionality or any modification to the auth module. It takes a lots of efforts even in figuring out how that can be done.
Is Django that difficult to customize or its just lack of the help available over internet for this or its me who is moving in the wrong direction ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您没有提供有关您想要实现的目标的足够详细信息,因此很难说任务有多复杂。您可能还需要考虑根本不修改管理站点并在适当的情况下构建您自己的视图。
不过,这里有一些很好的链接可以帮助您入门:
You are not providing enough details on what you want to achieve, so it's difficult to say how complex the task is. You might also want to consider not modifying the admin site at all and building your own views where appropriate.
However, here are some good links to get you started:
就个人而言,如果您希望网站看起来像管理员,为什么不提取模板和样式并使用它们,根据需要构建您自己的视图。大量的文档和论坛帮助就是为此提供的。我喜欢自定义管理的想法,但说实话,我在一个项目上这样做已经有一段时间了,我一次又一次地想,如果这是用标准的 MVC(或 MTV)方式构建的,并且有免费的在线模板,复制管理员的,或者一些专业制作的,并使用大量的插件和我的代码构建,这会容易得多!而且,当您确定请求/响应不能解决问题,并且您想要添加大量 JavaScript 时,您会很高兴。我知道。我不得不将各种 JavaScript 放入我们的管理项目中。主要是因为不可能让管理员做我们想做的事,所以我们在屏幕上显示后用 JavaScript 修复它。当您发现自己正在编写一个基于 Ajax 的系统时,您会想知道为什么要拥有管理员。
如果我可以重新开始这个项目,我什至可能不会使用 Django,但我可能会。我肯定不会使用管理员。
现在,如果您正在构建一个基本的 CRUD 类型网站,但没有时尚眼光的用户,那么 Django 和 grappelli 以及一些苦劳就能完成这项工作。请记住,Django 是 Python 脚本的集合。只要你不顾一切,只要你不是太有野心,你就能到达那里。
Personally, if you want a site to look like the admin, why not pull the templates and styles and use them, build your own views for what you need. Gobs of documentation and forum help is there for that. I like the idea of customizing the admin, but honestly, I have been doing it for awhile on a project and time and time again I think to myself, if this was built in the standard MVC (or MTV) manner with free templates online, copied admin ones, or some professionally made ones, and built with the plethora of addons and my code, it would be much easier!!! And, when you decide that request/response isn't cutting it, and you want to add lots of JavaScript, you'll be glad. I know. I have had to put all sorts of JavaScript on our Admin project. Mostly because it's impossible to make the admin do what we want, so we fix it with JavaScript once it is on screen. When you find yourself writing an Ajax based system, you'll wonder why you have the admin at all.
If I could start this project over, I might not even use Django, but I probably would. I most certainly won't used the Admin.
Now, if you are building an basic CRUD type site that doesn't have style-eyed users, then Django with grappelli, and some elbow grease will get the job done. Remember, Django is a collection of Python scripts. Just override everything you can, and you'll get there, if you aren't too ambitious.
如果您的需求与 Django 中的可自定义内容相匹配,则 Django Admin 很容易自定义。如果您需要的奇特功能不是开箱即用的功能,您要么需要找到一个可以实现该功能的插件,要么通过子类化适当的类来自己实现它。这可能很困难,并且需要对 Django 的内部结构有很好的了解。
总而言之:它使设置管理员变得更容易,但如果您需要任何特殊的东西,但不是开箱即用的:您的学习曲线很陡峭。
根据您的要求,您可以选择使用或不使用 django。任何需要大量功能规范的事情最好手动实现。
Django Admin is easy to customize if your requirements match what is customizable in Django. If you need fancy features that are not out-of-the-box functionality you either need to find a plugin that does it, or implement it yourself by subclassing the appropriate classes. Which can be difficult, and requires good understanding of the internals of Django.
So in summary: it makes it easier to setup an admin, but if you need anything special that's not out of the box: you got a steep learning curve.
Depending on your requirements you can choose to use django or not. Anything that requires a lot of functional speccing is better of implemented manually.
这很容易。只需将默认模板复制到项目并更改 HTML 和一些变量位置
即可在此视频中查看
https://youtu.be/NTZfjwf4F8A< /a>
It's very easy . Just copy default template to project and change HTML and some variable location
Just see in this vedio
https://youtu.be/NTZfjwf4F8A