AttributeError: 'tuple' object has no attribute 'insert'

:warning:This is a template you must use to report issues. :warning:
You can also drag images, videos and include Preformatted text.

Feature(s) impacted

Please describe in this mandatory section the feature(s) that will be discussed in this topic.
Hi Everyone,

Trying to get django-forestadmin running I got into this error after executing the python manage.py runserver script.

Observed behavior

Please describe in this mandatory section the current behavior you observe.
Here is the output error:


File “/home/frendy13/desima/toladata/django_forest/utils/middlewares.py”, line 5, in set_middlewares
settings.MIDDLEWARE.insert(0, ‘django_forest.middleware.PermissionMiddleware’)
AttributeError: ‘tuple’ object has no attribute ‘insert’

Expected behavior

Please describe in this mandatory section the behavior you are expecting.
In fact I expect to see the URL by which I could reach my project admin site

Failure Logs

In this optional section, please:

  • include any relevant log snippets if necessary,
  • or remove this section if left empty.

Context

Please provide in this mandatory section, the relevant information about your configuration:

  • Project name: tolada
  • Team name: none
  • Environment name: development
  • Agent type & version: django-forestadmin latest version
  • Recent changes made on your end if any: I just install and try to run the project

Hi @Dener_Francois,

I’m working on this issue and I’m going to fix it soon.
If you don’t want to wait the new version, you just have to change your settings to have a list of middlewares instead of a tuple of middlewares.

Ex:

# Currently
MIDDLEWARE = (
    your_middleware,
    ...
)

# Replaced by
MIDDLEWARE = [
    your_middleware,
    ...
]

1 Like

Hi @Dener_Francois,

I released the version 1.1.2 of the django agent.
This new version fix your issue.

Thank’s.

1 Like

Thanks a lot for this prompt response and fix. I upgrade to the 1.1.2 release as follows:
pip3 install --upgrade django-forestadmin
is it correct? otherwise, please show me the true way of doing it.

But the issue remains the same. But when I adjusted the setting.py as you’ve suggested, it was gone. Nevertheless, I came into a new one:
"TypeError: Object of type Decimal is not JSON serializable"

So thanks for your assistance in resolving this issue. the screenshot is attached.

@Dener_Francois

Can you run a pip freeze and give me the output please ?
Can you give me your settings with the MIDDLEWARE parts ?

I don’t reproduce your second issue.
Do you use some custom fields to store decimal in your models?

Thank’s

Thanks for asking. Here there are the files. But the .forestadmin-schema.json file is empty.

(Attachment pip-freeze-command-output-3-2-2022.txt is missing)

(Attachment middleware-settings-py.txt is missing)

Sorry but I don’t see your attachments.

Thanks for asking. Here there are the files. But the .forestadmin-schema.json file is empty.
Pip freeze output:

You’re right but I couldn’t send attachments anymore as your system didn’t accept a .txt file. So I integrated the content of the files in the body of the email message as follows:

Pip freeze output: