Description
Describe the bug
I've implemented the GridContainerRenderMixin from the documentation to add a background image and blur effect to a container. Everything works fine as long as I set a background image.
Problem:
If I remove the background image from a container that previously had one, the plugin refuses to render and throws the following error:
Exception when executing plugin.render in GridContainerPlugin (id=113)
TypeError: 'NoneType' object is not subscriptable
This issue persists until I add back a background image or until the server is restarted.
If I create multiple container plugins, some with a background and some without, the ones without a background will consistently trigger the same error.
To Reproduce
Steps to reproduce the behavior:
Steps to reproduce the behavior:
- Create a GridContainerPlugin and assign a background image.
- Remove the background image and save the container.
- The plugin fails to render and throws an error.
OR
- Create 2 GridContainerPlugin
- Assign a background image to one of them.
- The plugin that do not have a background fails to render and throws an error.
Expected behavior
The GridContainerPlugin should be able to render when the background_image is deleted.
The GridContainerPlugin should be able to render with or without a background_image in any case.
Screenshots
Desktop (please complete the following information):
- Windows
- Chrome
- Version 132.0.6834.160
Additional context
Terminal log :
GridContainer.render for plugin pk=113 raised an exception
Traceback (most recent call last):
File "/home/enkil/Luciole/luciole_env/lib/python3.12/site-packages/cms/plugin_rendering.py", line 474, in render_plugin
context = plugin.render(context, instance, placeholder.slot)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/enkil/Luciole/Luciole/theme/frameworks/bootstrap5.py", line 31, in render
print(instance.container_image)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/enkil/Luciole/luciole_env/lib/python3.12/site-packages/djangocms_frontend/helpers.py", line 41, in get
obj = get_related_object(instance.config, self.key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/enkil/Luciole/luciole_env/lib/python3.12/site-packages/djangocms_frontend/helpers.py", line 27, in get_related_object
Model = apps.get_model(scope[field_name]["model"])
~~~~~~~~~~~~~~~~~^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status