开发者

How to add a custom method to Django's Admin Console?

开发者 https://www.devze.com 2023-01-12 10:46 出处:网络
Ok, so in our employee database, we keep a list of all employees and we get this information contained within a data file that is produced by our HR system. The script to truncate the table and popula

Ok, so in our employee database, we keep a list of all employees and we get this information contained within a data file that is produced by our HR system. The script to truncate the table and populate it with the employee information is done and works nicely. However, I would like the method call to do this from within the application. I thought it would be best to add it to the Admin console since only superusers are allowed to do this. So, is there a way to add a method/link to the console that is not directly model/data r开发者_开发百科elated?

Thanks! Eric


Override the app_index.html admin template (see documentation) and add the url to your view.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号