jrief / django-admin-sortable2

Generic drag-and-drop ordering for objects in the Django admin interface
https://django-admin-sortable2.readthedocs.io/en/latest/
Other
773 stars 180 forks source link

Fix for getattr error in the admin #371

Open sgordeychuk opened 1 year ago

sgordeychuk commented 1 year ago

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 commented 1 year ago

Which bug does this fix?

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

sgordeychuk commented 1 year ago

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:

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 commented 7 months ago

I confirm this problem exists.