Environment:
Request Method: GET
Request URL: /publish/-Zh1FO6cZ_U
Django Version: 5.0.6
Python Version: 3.11.9
Installed Applications:
['icosa',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.staticfiles',
'django.contrib.messages',
'compressor',
'huey.contrib.djhuey']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'icosa.middleware.redirect.RemoveSlashMiddleware']
Template error:
In template /opt/icosa/templates/partials/viewer.html, error at line 11
'NoneType' object has no attribute 'internal_url_or_none'
1 : <script type="module">
2 : import {Viewer} from "/static/js/icosa-viewer.module.js?v={% now "U" %}";
3 :
4 : var viewer = new Viewer("https://icosa-foundation.github.io/icosa-sketch-assets/");
5 : let defaultBgColor = '{{ asset.background_color|default:"#000000" }}';
6 :
7 : // For debugging
8 : window.viewer = viewer;
9 : window.THREE = viewer.three;
10 :
11 : let url = " {{ asset.preferred_viewer_format.url }} ";
12 : let formatType = "{{ asset.preferred_viewer_format.format }}".toLowerCase();
13 :
14 : if (formatType === 'gltf2' || formatType === 'glb') {
15 : try {
16 : console.log("Trying to load as GLTF2");
17 : await viewer.loadGltf(url, true, defaultBgColor);
18 : } catch (error) {
19 : console.log(error);
20 : console.log("GLTF2 failed. Trying to load as GLTF1");
21 : await viewer.loadGltf1(url, true, defaultBgColor);
Traceback (most recent call last):
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 875, in _resolve_lookup
current = current[bit]
^^^^^^^^^^^^
During handling of the above exception ('Asset' object is not subscriptable), another exception occurred:
File "/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapper_view
return view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/icosa/views/main.py", line 318, in publish_asset
return render(
File "/venv/lib/python3.11/site-packages/django/shortcuts.py", line 25, in render
content = loader.render_to_string(template_name, context, request, using=using)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/loader.py", line 62, in render_to_string
return template.render(context, request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 171, in render
return self._render(context)
^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 961, in render_annotated
return self.render(context)
^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/loader_tags.py", line 159, in render
return compiled_parent._render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 961, in render_annotated
return self.render(context)
^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/loader_tags.py", line 65, in render
result = block.nodelist.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 961, in render_annotated
return self.render(context)
^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/loader_tags.py", line 210, in render
return template.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 173, in render
return self._render(context)
^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 961, in render_annotated
return self.render(context)
^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 1059, in render
output = self.filter_expression.resolve(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 710, in resolve
obj = self.var.resolve(context)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 842, in resolve
value = self._resolve_lookup(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/django/template/base.py", line 885, in _resolve_lookup
current = getattr(current, bit)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/icosa/models.py", line 343, in preferred_viewer_format
format = self._preferred_viewer_format
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/icosa/models.py", line 325, in _preferred_viewer_format
"url": root.internal_url_or_none,
^^^^^^^^^^^^^^^^^^^^^^^^^
Exception Type: AttributeError at /publish/-Zh1FO6cZ_U
Exception Value: 'NoneType' object has no attribute 'internal_url_or_none'