Fix for getattr error in the admin
There's an error getattr(): attribute name must be string in the line of admin, it was failing to add django CMS plugins on a clean installation
Which bug does this fix?
Can you please give me instructions on how to reproduce this.
Hi @jrief
Sorry, it was late night and I forgot to properly describe the case. Should open a ticket in Issues tab or here is enough?
Anyhow here's the scenario.
Requirements:
- Django 4.2.4
- Django CMS 3.11.3
- django-adminsortable2 2.1.9
- Any django CMS plugin which uses some components of adminsortable2 (in my case it was djangocms-socialshare which uses SortableInlineAdminMixin)
Steps:
- Run migrations on empty DB (that doesn't really matter)
- Add a plugin to the home page, in my case it was Social Share plugin
- In the admin popup of the plugin add some elements using
SortableInlineAdminMixin(which then inherits fromCustomInlineFormSetMixinwhich has the root cause error) - Click "Add"
After clicking add there's an error getattr(): attribute name must be string displayed. Please see screenshot.
You can also use this template as is https://github.com/django-cms/djangocms-template to reproduce the error. You can checkout and it should work out of the box. The issue won't reproduce there because it has forked version with a fix, but if you install django-adminsortable2==2.1.9 then you can get the error reproduced using the scenario above.
Please let me know if you need more details.
I confirm this problem exists.