adfinis / timed

Monorepo for the Timed time-tracking application
GNU Affero General Public License v3.0
4 stars 5 forks source link

fix(backend): fix ProjectAssigneeInline has no attribute inlines error #240

Closed c0rydoras closed 1 month ago

c0rydoras commented 1 month ago

this should make it so projects can be created via django admin again

winged commented 1 month ago

Not sure this is the right way to fix it - other admin Inlines don't have the attribute either. If you looked at the exception, what was the context of the call site?

c0rydoras commented 1 month ago

I don't remember, steps to reproduce:

  1. Navigate to timed instance
  2. /admin
  3. Create project
  4. Receive error
c0rydoras commented 1 month ago

I don't think this is the right way to fix this, but it could be a temporary fix

c0rydoras commented 1 month ago

Heres the stacktrace

Environment:

Request Method: POST
Request URL: https://timed.local/admin/projects/project/add/

Django Version: 4.2.11
Python Version: 3.12.2
Installed Applications:
['timed.apps.TimedAdminConfig',
 'django.contrib.humanize',
 'multiselectfield.apps.MultiSelectFieldConfig',
 'django.forms',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'hurricane',
 'rest_framework',
 'django_filters',
 'djmoney.apps.MoneyConfig',
 'mozilla_django_oidc',
 'django_prometheus.apps.DjangoPrometheusConfig',
 'corsheaders',
 'nested_inline',
 'timed.employment',
 'timed.projects',
 'timed.tracking',
 'timed.reports',
 'timed.redmine',
 'timed.subscription',
 'timed.notifications',
 'django_extensions']
Installed Middleware:
['django_prometheus.middleware.PrometheusBeforeMiddleware',
 'corsheaders.middleware.CorsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django_prometheus.middleware.PrometheusAfterMiddleware',
 'whitenoise.middleware.WhiteNoiseMiddleware']

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/contrib/admin/options.py", line 688, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/utils/decorators.py", line 134, in _wrapper_view
    response = view_func(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/views/decorators/cache.py", line 62, in _wrapper_view_func
    response = view_func(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/contrib/admin/sites.py", line 242, in inner
    return view(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/utils/decorators.py", line 46, in _wrapper
    return bound_method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/utils/decorators.py", line 134, in _wrapper_view
    response = view_func(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/nested_inline/admin.py", line 196, in add_view
    if inline.inlines:
       ^^^^^^^^^^^^^^

Exception Type: AttributeError at /admin/projects/project/add/
Exception Value: 'ProjectAssigneeInline' object has no attribute 'inlines'

https://dpaste.com/2EYZZ9CSK