django-categories icon indicating copy to clipboard operation
django-categories copied to clipboard

Not seeing category fields in admin?

Open heymarkreeves opened this issue 11 years ago • 5 comments

I installed (pip) django-categories today, and added a field in my model:

categories = models.ManyToManyField('categories.Category', blank=True, null=True)

before running syncdb.

I have Categories in my admin, and I'm not seeing any file errors for treeTable or expand/collapse files, but I'm only seeing 1 level deep:

http://www.circa1977.net/snap/admin-categories.png

In the source for the page, I can see the child rows, but they don't show in the admin. Nor does a expand/collapse toggle.

The following doesn't seem to be true, either. I'm using fieldsets, and the categories field only shows up if I include it in the fieldsets in my ModelAdmin.

https://django-categories.readthedocs.org/en/latest/admin_settings.html

I'm using Django 1.6.

Should I be seeing something else in the admin? How do I enable the treeview + checkboxes described in the docs?

Thanks!

Mark

heymarkreeves avatar Nov 15 '13 21:11 heymarkreeves

I do have categories.editor installed as well.

heymarkreeves avatar Nov 15 '13 23:11 heymarkreeves

Django 1.6 includes jQuery 1.9.1 in the admin. It looks like treeTable.js needs to be updated in django-categories to be compatible.

I'm currently working on trying to get jQueryMigrate included.

heymarkreeves avatar Nov 19 '13 15:11 heymarkreeves

I've overridden change_list.html to try jQueryMigrate or specify jQuery 1.8.3 to no avail. Something in treeTable.js just isn't enhancing the table. I can force expanded view within the tree_editor.html template and see all the rows, but the expand/collapse toggles are never revealed.

heymarkreeves avatar Nov 19 '13 16:11 heymarkreeves

This was purely an issue with how treeTable.js and treeTable.css are working. Specifically, line 427 of treeTable.js needed the negative margin-left inline style removed. I then tweaked column & .expanded width values in treeTable.css to see things properly.

heymarkreeves avatar Nov 19 '13 17:11 heymarkreeves

The simple fix:

Put: .treeTable td:nth-of-type(1) { padding-left: 21px; padding-right: 10px; }

in: editor/static/editor/jquery.treeTable.css

mnestor avatar Jan 09 '14 16:01 mnestor