| 670 | .. attribute:: ModelAdmin.change_list_template |
| 671 | |
| 672 | .. versionadded:: 1.0 |
| 673 | |
| 674 | Path to a custom template that will be used by the model objects "change list" |
| 675 | view. The template file searching order and precedence rules and modular |
| 676 | extension strategy recommendations outlined in the `Overriding Admin Templates`_ |
| 677 | section apply here. |
| 678 | |
| 679 | If you don't specify it, a default template shipped with Django that provides |
| 680 | the standard appearance is used. |
| 681 | |
| 682 | .. attribute:: ModelAdmin.change_form_template |
| 683 | |
| 684 | .. versionadded:: 1.0 |
| 685 | |
| 686 | Path to a custom template that will be used by both the model object creation |
| 687 | and change views. The template file searching order and precedence rules and |
| 688 | modular extension strategy recommendations outlined in the `Overriding Admin |
| 689 | Templates`_ section apply here. |
| 690 | |
| 691 | If you don't specify it, a default template shipped with Django that provides |
| 692 | the standard appearance is used. |
| 693 | |
| 694 | .. attribute:: ModelAdmin.object_history_template |
| 695 | |
| 696 | .. versionadded:: 1.0 |
| 697 | |
| 698 | Path to a custom template that will be used by the model object change history |
| 699 | display view. The template file searching order and precedence rules and modular |
| 700 | extension strategy recommendations outlined in the `Overriding Admin Templates`_ |
| 701 | section apply here. |
| 702 | |
| 703 | If you don't specify it, a default template shipped with Django that provides |
| 704 | the standard appearance is used. |
| 705 | |
| 706 | .. attribute:: ModelAdmin.delete_confirmation_template |
| 707 | |
| 708 | .. versionadded:: 1.0 |
| 709 | |
| 710 | Path to a custom template that will be used by the view responsible of showing |
| 711 | the confirmation page when the user decides to delete one or more model objects. |
| 712 | The template file searching order and precedence rules and modular extension |
| 713 | strategy recommendations outlined in the `Overriding Admin Templates`_ section |
| 714 | apply here. |
| 715 | |
| 716 | If you don't specify it, a default template shipped with Django that provides |
| 717 | the standard appearance is used. |
| 718 | |
| 814 | Other methods |
| 815 | ~~~~~~~~~~~~~ |
| 816 | |
| 817 | .. method:: ModelAdmin.add_view(self, request, form_url='', extra_context=None) |
| 818 | |
| 819 | Django view for the model instance addition page. See note below. |
| 820 | |
| 821 | .. method:: ModelAdmin.change_view(self, request, object_id, extra_context=None) |
| 822 | |
| 823 | Django view for the model instance edition page. See note below. |
| 824 | |
| 825 | .. method:: ModelAdmin.changelist_view(self, request, extra_context=None) |
| 826 | |
| 827 | Django view for the model instances change list/actions page. See note below. |
| 828 | |
| 829 | .. method:: ModelAdmin.delete_view(self, request, object_id, extra_context=None) |
| 830 | |
| 831 | Django view for the model instance(s) deletion confirmation page. See note below. |
| 832 | |
| 833 | .. method:: ModelAdmin.history_view(self, request, object_id, extra_context=None) |
| 834 | |
| 835 | Django view for the page that shows the modification history for a given model |
| 836 | instance. |
| 837 | |
| 838 | Unlike the hook-type ``ModelAdmin`` methods detailed in the previous section, |
| 839 | these five methods are in reality designed to be invoked as Django views from |
| 840 | the admin application URL dispatching handler to render the pages that deal |
| 841 | with model instancies CRUD operations. Because of that they implement the |
| 842 | complex logic specific to the generic nature of the admin app and there aren't |
| 843 | many possibilities to customize their behavior other than replace their |
| 844 | implementation. |
| 845 | |
| 846 | .. versionadded:: 1.0 |
| 847 | |
| 848 | Nonetheless, you still can customize the presentation of their respective pages |
| 849 | (possibly transforming them completely) if needed: For this, you override the |
| 850 | method in your ``ModelAdmin`` subclass to augment the context provided to the |
| 851 | template layer using its ``extra_context`` parameter and at the same time |
| 852 | override the associated template used by the admin with the respective |
| 853 | ``*_template`` option described in the `ModelAdmin options`_ section. An |
| 854 | example:: |
| 855 | |
| 856 | class MyModelAdmin(admin.ModelAdmin): |
| 857 | |
| 858 | # A template for a very customized change view: |
| 859 | change_form_template = 'admin/myapp/extras/openstreetmap_change_form.html' |
| 860 | |
| 861 | def get_osm_info(self): |
| 862 | # ... |
| 863 | |
| 864 | def change_view(self, request, form_url='', extra_context=None): |
| 865 | my_context = { |
| 866 | 'osm_data': self.get_osm_info(), |
| 867 | } |
| 868 | return super(MyModelAdmin, self).change_view(request, |
| 869 | extra_context=my_context)) |
| 870 | |
| 1260 | ``AdminSite`` attributes |
| 1261 | ------------------------ |
| 1262 | |
| 1263 | .. attribute:: AdminSite.index_template |
| 1264 | |
| 1265 | .. versionadded:: 1.0 |
| 1266 | |
| 1267 | Path to a custom template that will be used by the admin site main index view. |
| 1268 | The template file searching order and precedence rules and modular extension |
| 1269 | strategy recommendations outlined in the `Overriding Admin Templates`_ section |
| 1270 | apply here. |
| 1271 | |
| 1272 | .. attribute:: AdminSite.login_template |
| 1273 | |
| 1274 | .. versionadded:: 1.0 |
| 1275 | |
| 1276 | Path to a custom template that will be used by the admin site login view. |
| 1277 | The template file searching order and precedence rules and modular extension |
| 1278 | strategy recommendations outlined in the `Overriding Admin Templates`_ section |
| 1279 | apply here. |
| 1280 | |