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

django-mptt support #243

Closed
honi opened this issue Nov 14, 2012 · 9 comments
Closed

django-mptt support #243

honi opened this issue Nov 14, 2012 · 9 comments
Assignees

Comments

@honi
Copy link

honi commented Nov 14, 2012

When using MPTTModelAdmin from django-mptt, the change list template is messed up. Has anybody fixed this?

@BertrandBordage
Copy link
Contributor

I had the same issue, so I am not currently using MPTTModelAdmin with my MPTTModels. A fix would be awesome.

@honi
Copy link
Author

honi commented Nov 21, 2012

You can install FeinCMS, and then you'll have available the FeinCMSModelAdmin which is bundled with django-mptt. It subclasses FeinCMS's TreeEditor, which displays fine with grappelli's styles, and adds extra features to the changelist, like expandable / collapsable nodes, drag & drop for re ordering nodes and AJAX boolean editables.

Though there are some look & feel issues with FeinCMSModelAdmin that don't match very well with Grappelli.

And also I'm not really happy with having to install FeinCMS just to use its TreeEditor. Would it be a good addition for Grappelli to support MPTT models out of the box? I would be happy to try to add this support, refactoring out FeinCMS's TreeEditor into Grappelli. Or maybe its not that big deal having to install FeinCMS, and then Grappelli could just override the templates to fix the look & feel issues.

@sehmaschine
Copy link
Owner

supporting django-mptt is definitely planned, but I need to take a closer look at the possible issues. supporting FeinCMS is not planned though.

@ghost ghost assigned sehmaschine Jan 3, 2013
@sehmaschine
Copy link
Owner

I´ve been taking a look at django–mptt. Integration with Grappelli is easy (we just need to add 2 simple templates), but it´ll never look nice because of this:

https://github.com/django-mptt/django-mptt/blob/master/mptt/templatetags/mptt_admin.py#L102

hardcoded margin with python-code. WTF!

@BertrandBordage
Copy link
Contributor

It could work if we changed this hard-coded padding with something like ' ' * level. But this can't take MPTT_ADMIN_LEVEL_INDENT into account… We therefore need to convince the django-mptt to remove this setting. Or make an ugly copy-paste of this template tag with a few changes. Or write it here or in the docs this pseudo-solution for those wanting to get this working.

@sehmaschine
Copy link
Owner

there should be a class instead of the hardcoded padding. if the guys over at django–mptt will change this, integration with grappelli is easy.

@sehmaschine
Copy link
Owner

Here´s a workaround: see https://gist.github.com/4452240

I´m closing this ticket for now. If the guys doing django–mptt will remove the paddings from python code, we´ll support mptt.

@BertrandBordage
Copy link
Contributor

Looks like the problem is already solved in django-mptt/master, as you can see here: django-mptt/django-mptt@686f536.

@karolyi
Copy link

karolyi commented Oct 19, 2015

+1

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

No branches or pull requests

4 participants