Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for getattr error in the admin #371

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sgordeychuk
Copy link

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

Screenshot by Dropbox Capture

@jrief
Copy link
Owner

jrief commented Aug 21, 2023

Which bug does this fix?

Can you please give me instructions on how to reproduce this.

@sgordeychuk
Copy link
Author

sgordeychuk commented Aug 21, 2023

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:

  1. Run migrations on empty DB (that doesn't really matter)
  2. Add a plugin to the home page, in my case it was Social Share plugin
  3. In the admin popup of the plugin add some elements using SortableInlineAdminMixin (which then inherits from CustomInlineFormSetMixin which has the root cause error)
  4. 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.

@fazafantast
Copy link

I confirm this problem exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants