Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated Admin docs to include guidance on third party interoperability #1614

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/advanced_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,31 @@ return books for the publisher::
class Meta:
model = Book

.. _interoperability:

Interoperability with 3rd party libraries
-----------------------------------------

import_export extends the Django Admin interface. There is a possibility that clashes may occur with other 3rd party
libraries which also use the admin interface.

django-admin-sortable2
^^^^^^^^^^^^^^^^^^^^^^

Issues have been raised due to conflicts with setting `change_list_template <https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.change_list_template>`_. There is a workaround listed `here <https://github.com/jrief/django-admin-sortable2/issues/345#issuecomment-1680271337>`_.
EricOuma marked this conversation as resolved.
Show resolved Hide resolved
Also, refer to `this issue <https://github.com/django-import-export/django-import-export/issues/1531>`_.
If you want to patch your own installation to fix this, a patch is available `here <https://github.com/django-import-export/django-import-export/pull/1607>`_.

django-polymorphic
^^^^^^^^^^^^^^^^^^

Refer to `this issue <https://github.com/django-import-export/django-import-export/issues/1521>`_.

template skipped due to recursion issue
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Refer to `this issue <https://github.com/django-import-export/django-import-export/issues/1514#issuecomment-1344200867>`_.

.. _admin_security:

Security
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Changelog
- Removed reference to tablib dev from tox build (#1603)
- Add customizable blocks in import.html (#1598)
- Updated ru translation (#1604)
- Updated documentation for interoperability with third party libraries (#1614)

3.2.0 (2023-04-12)
------------------
Expand Down
6 changes: 6 additions & 0 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,9 @@ See :ref:`advanced_usage:Foreign key relations`.
This can occur if a model defines a ``__str__()`` method which references a primary key or
foreign key relation, and which is ``None`` during import. There is a workaround to deal
with this issue. Refer to `this comment <https://github.com/django-import-export/django-import-export/issues/1556#issuecomment-1466980421>`_.

'failed to assign change_list_template attribute' warning in logs
-----------------------------------------------------------------

This indicates that the change_list_template attribute could not be set, most likely due to a clash with a third party
library. Refer to :ref:`interoperability`.
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ If set to ``True``, strings will be HTML escaped. By default this is ``False``.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If set to ``True``, strings will be sanitized by removing any leading '=' character. This is to prevent execution of
Excel formulae. By default this is ``False``.
Excel formulae. By default this is ``False``.

``IMPORT_EXPORT_FORMATS``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 1 addition & 3 deletions import_export/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ def init_change_list_template(self):
self, "import_export_change_list_template", None
)
except AttributeError:
logger.warning(
"failed to assign change_list_template attribute (see issue 1521)"
)
logger.warning("failed to assign change_list_template attribute")

if self.change_list_template is None:
self.change_list_template = self.base_change_list_template
Expand Down
2 changes: 1 addition & 1 deletion tests/core/tests/test_admin_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ def change_list_template(self):

TestImportCls()
mock_logger.warning.assert_called_once_with(
"failed to assign change_list_template attribute (see issue 1521)"
"failed to assign change_list_template attribute"
)

@override_settings(IMPORT_FORMATS=[base_formats.XLSX, base_formats.XLS])
Expand Down