usnistgov / NEMO

NEMO is a laboratory logistics web application. Use it to schedule reservations, control tool access, track maintenance issues, and more.
Other
137 stars 63 forks source link

mptt_tags #54

Closed sbonaime closed 3 years ago

sbonaime commented 3 years ago

I just upgrade to Nemo 3.5.0 from older version. For now, everything is ok except when I cant to see a user on the /user page. After clicl on one user I have the following error page

Request Method: | GET
-- | --
http://127.0.0.1:9000/user/1/
2.2.13
TemplateSyntaxError
'mptt_tags' is not a registered tag library. Must be one of: admin_list admin_modify admin_static admin_urls cache custom_tags_and_filters humanize i18n l10n log rest_framework static staticfiles tz
/usr/local/lib/python3.6/site-packages/django/template/defaulttags.py in find_library, line 1025
/usr/local/bin/python
3.6.10
['/usr/local/bin',  '/nemo',  '/usr/local/lib/python36.zip',  '/usr/local/lib/python3.6',  '/usr/local/lib/python3.6/lib-dynload',  '/usr/local/lib/python3.6/site-packages']
lun, 30 Nov 2020 14:53:49 +0100

And in the django_error.log

==> /nemo/logs/django_error.log <==
Internal Server Error: /user/1/
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/django/template/defaulttags.py", line 1021, in find_library
    return parser.libraries[name]
KeyError: 'mptt_tags'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/views/decorators/http.py", line 40, in inner
    return func(request, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/NEMO/views/users.py", line 104, in create_or_modify_user
    return render(request, 'users/create_or_modify_user.html', dictionary)
  File "/usr/local/lib/python3.6/site-packages/django/shortcuts.py", line 36, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "/usr/local/lib/python3.6/site-packages/django/template/loader.py", line 61, in render_to_string
    template = get_template(template_name, using=using)
  File "/usr/local/lib/python3.6/site-packages/django/template/loader.py", line 15, in get_template
    return engine.get_template(template_name)
  File "/usr/local/lib/python3.6/site-packages/django/template/backends/django.py", line 34, in get_template
    return Template(self.engine.get_template(template_name), self)
  File "/usr/local/lib/python3.6/site-packages/django/template/engine.py", line 143, in get_template
    template, origin = self.find_template(template_name)
  File "/usr/local/lib/python3.6/site-packages/django/template/engine.py", line 125, in find_template
    template = loader.get_template(name, skip=skip)
  File "/usr/local/lib/python3.6/site-packages/django/template/loaders/base.py", line 30, in get_template
    contents, origin, origin.template_name, self.engine,
  File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 156, in __init__
    self.nodelist = self.compile_nodelist()
  File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 194, in compile_nodelist
    return parser.parse()
  File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 478, in parse
    raise self.error(token, e)
  File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 476, in parse
    compiled_result = compile_func(self, token)
  File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py", line 266, in do_extends
    nodelist = parser.parse()
  File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 478, in parse
    raise self.error(token, e)
  File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 476, in parse
    compiled_result = compile_func(self, token)
  File "/usr/local/lib/python3.6/site-packages/django/template/defaulttags.py", line 1078, in load
    lib = find_library(parser, name)
  File "/usr/local/lib/python3.6/site-packages/django/template/defaulttags.py", line 1025, in find_library
    name, "\n".join(sorted(parser.libraries)),
django.template.exceptions.TemplateSyntaxError: 'mptt_tags' is not a registered tag library. Must be one of:
admin_list
admin_modify
admin_static
admin_urls
cache
custom_tags_and_filters
humanize
i18n
l10n
log
rest_framework
static
staticfiles
tz

What can I do ? The 3.5.0 upgrade went smoothly

sbonaime commented 3 years ago

I solved the problem by adding 'mptt' to settings.py. See this link https://www.wemakeitclear.com/fr/blog/blog_details/8/mptt_tags-is-not-a-registered-tag-library-must-be-one-of

rptmat57 commented 3 years ago

For the record, this was introduced in version 3.0.0 and instructions are provided in the release notes: https://github.com/usnistgov/NEMO/releases/tag/3.0.0