How to override and extend basic Django admin templates?

前端 未结 11 1015
长发绾君心
长发绾君心 2020-11-22 14:11

How do I override an admin template (e.g. admin/index.html) while at the same time extending it (see https://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-vs-r

11条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-22 14:50

    I agree with Chris Pratt. But I think it's better to create the symlink to original Django folder where the admin templates place in:

    ln -s /usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/ templates/django_admin
    

    and as you can see it depends on python version and the folder where the Django installed. So in future or on a production server you might need to change the path.

提交回复
热议问题