2
0

chooseparentview.rst 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ======================================
  2. Customising ``ChooseParentView``
  3. ======================================
  4. When adding a new page via Wagtail's explorer view, you essentially choose
  5. where you want to add a new page by navigating the relevant part of the page
  6. tree and choosing to 'add a child page' to your chosen parent page. Wagtail
  7. then asks you to select what type of page you'd like to add.
  8. When adding a page from a ``ModelAdmin`` list page, we know what type of page
  9. needs to be added, but we might not automatically know where in the page tree
  10. it should be added. If there's only one possible choice of parent for a new page
  11. (as defined by setting ``parent_page_types`` and ``subpage_types`` attributes
  12. on your models), then we skip a step and use that as the parent. Otherwise, the
  13. user must specify a parent page using modeladmin's ``ChooseParentView``.
  14. It should be very rare that you need to customise this view, but in case you
  15. do, modeladmin offers the following attributes that you can override:
  16. .. contents::
  17. :local:
  18. :depth: 1
  19. .. _modeladmin_choose_parent_template_name:
  20. ------------------------------------------
  21. ``ModelAdmin.choose_parent_template_name``
  22. ------------------------------------------
  23. **Expected value**: The path to a custom template to use for
  24. ``ChooseParentView``
  25. See the following part of the docs to find out more:
  26. :ref:`modeladmin_overriding_templates`
  27. .. _modeladmin_choose_parent_view_class:
  28. ------------------------------------------
  29. ``ModelAdmin.choose_parent_view_class``
  30. ------------------------------------------
  31. **Expected value**: A custom ``view`` class to replace
  32. ``modeladmin.views.ChooseParentView``
  33. See the following part of the docs to find out more:
  34. :ref:`modeladmin_overriding_views`