harvard-lil / h2o

H2O is a web app for creating and reading open educational resources, primarily in the legal field
https://opencasebook.org
GNU Affero General Public License v3.0
36 stars 30 forks source link

Adding a single item as an Outline type results in an unrenderable Resource #1988

Closed sentry-io[bot] closed 1 year ago

sentry-io[bot] commented 1 year ago

Entering a single item via the Outline dropdown produces a single Resource in the TOC marked Outline. If you click on this item you get taken to the Edit page (fine), but clicking on Preview from here returns a server error.

Sentry Issue: H2O-AR

TypeError: 'ContentNode' object is not subscriptable
  File "django/template/base.py", line 829, in _resolve_lookup
    current = current[bit]

KeyError: 'Outline'
(34 additional frame(s) were not displayed)
...
  File "django/template/loader_tags.py", line 168, in render
    template = self.template.resolve(context)
  File "django/template/base.py", line 671, in resolve
    obj = self.var.resolve(context)
  File "django/template/base.py", line 796, in resolve
    value = self._resolve_lookup(context)
  File "django/template/base.py", line 837, in _resolve_lookup
    current = getattr(current, bit)
  File "main/models.py", line 2208, in body_template
    return {