Seeking feedback on proposed changes to django-mptt

88 views
Skip to first unread message

Craig de Stigter

unread,
Jul 28, 2016, 6:28:16 PM7/28/16
to django-mptt-dev
Hi folks

This is a call for feedback on some changes we'd like to make to django-mptt. I'd like to gather answers to the following questions:

Questions:
1. Are you still using django 1.8? If so, how long do you expect to be using it for?

2. Are you using or planning to use TreeManager.delay_mptt_updates() or .disable_mptt_updates()?

3. We're considering removing the ability to customise the names of mptt fields. (i.e. the fields will be hardcoded to names (lft, rght, tree_id, level, parent). Would this be a problem for you?

Some background:
@matthiask's PR #486 removes a lot of the magic in django-mptt. It removes field tracking and the ability to customise the field names, but fixes several bugs and makes the code a lot cleaner. It should make the code much more maintainable going forward and help encourage contributions etc.

I'm intending to eventually merge a cleaned-up version of that pull request for version 1.0. Hence the above questions. (In the meantime we'll release a 0.9 version with some deprecation warnings for the above, and hopefully no breaking changes)

Please reply even if this is all fine with you - positive feedback is good feedback too!

Cheers
Craig de Stigter

Olivier Dalang

unread,
Jul 31, 2016, 4:20:43 PM7/31/16
to django-mptt-dev
1. Are you still using django 1.8? If so, how long do you expect to be using it for?

No

2. Are you using or planning to use TreeManager.delay_mptt_updates() or .disable_mptt_updates()?

No

3. We're considering removing the ability to customise the names of mptt fields. (i.e. the fields will be hardcoded to names (lft, rght, tree_id, level, parent). Would this be a problem for you?

If going this way, I suggest prefixing the names with mptt_. level and parent could easily clash.
Maybe you could consider leaving parent customizable : while the other fields are only existing for the mptt algorithm, parent actually represents an actual relation.

Sergio Garcia

unread,
Jul 31, 2016, 5:37:35 PM7/31/16
to django-...@googlegroups.com
Hi,

I use django-mptt to create an accounting book, to better track the accounts and its balances, as a child entry can change its parent balance.
I have no problems with the current design but it will not be a problem the proposed changes.
Answering the questions:

1) I try to always use latest django, this sometimes breaks djanto-mptt-admin, never had an issue with mptt. Currently I'm using django 1.9 in production and 1.10 on dev.
2) No.
3) Not a problem, but I like Oliver's suggestion to prefix names.





--
You received this message because you are subscribed to the Google Groups "django-mptt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-mptt-d...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Craig de Stigter

unread,
Jul 31, 2016, 7:33:03 PM7/31/16
to django-...@googlegroups.com
Thanks everyone for the responses so far. That's really helpful.

I've also had a couple of private replies. If you'd prefer to reply privately for any reason, please feel free (send to crai...@gmail.com) . I won't share your reply but would definitely appreciate your feedback. Obviously if you're comfortable posting publicly then that would be better :)

We can definitely prefix the fields; that would be the best option going forward. The argument against that would be that it would require every user to migrate their fields. Whereas if we leave the names as they are, it would only require people to do a migration if they are using conflicting field names.

Certainly if we're going to rename any fields, we should prefix all of them. I'd be open to persuasion either way.

Cheers
Craig de Stigter

Matthias Kestenholz

unread,
Aug 1, 2016, 7:35:57 PM8/1/16
to django-...@googlegroups.com
Hi Sergio

On Sun, Jul 31, 2016 at 11:37 PM 'Sergio Garcia' via django-mptt-dev <django-...@googlegroups.com> wrote:
Hi,

I use django-mptt to create an accounting book, to better track the accounts and its balances, as a child entry can change its parent balance.
I have no problems with the current design but it will not be a problem the proposed changes.
Answering the questions:

1) I try to always use latest django, this sometimes breaks djanto-mptt-admin, never had an issue with mptt. Currently I'm using django 1.9 in production and 1.10 on dev.

Did you already try the DraggableMPTTAdmin introduced in django-mptt 0.8? This will always work with the released version of django-mptt :)

 
Best regards,
Matthias


--

Matthias Kestenholz

unread,
Aug 1, 2016, 7:35:57 PM8/1/16
to django-...@googlegroups.com
Hi,

On Sun, Jul 31, 2016 at 10:20 PM Olivier Dalang <olivier...@gmail.com> wrote:


3. We're considering removing the ability to customise the names of mptt fields. (i.e. the fields will be hardcoded to names (lft, rght, tree_id, level, parent). Would this be a problem for you?

If going this way, I suggest prefixing the names with mptt_. level and parent could easily clash.
Maybe you could consider leaving parent customizable : while the other fields are only existing for the mptt algorithm, parent actually represents an actual relation.

I find it very useful to be able to reference level and tree_id in the template. I also suspect that people have lots of code referencing at least level and tree_id in other projects — I know I do, in our CMS projects (we use level and tree_id for fetching the menu structure in feincms and feincms3). Prefixing those fields, esp. lft and rght would probably be a good choice if we were starting from scratch. I'm against changing it now because that would force most users to adapt their projects instead of only those who used the facility to change the default field names to fit their projects. 

Regarding a configurable name for the parent field: I found it interesting that the django-mptt testsuite never uses a different name than `parent` for the nodes' parent relations. I don't think it's worth it (I like the fact that getattr/setattr are mostly gone in my pull request), but that's not my call to make.

Thanks to everyone who gave feedback!

All the best,
Matthias

James Beith

unread,
Aug 9, 2016, 5:11:48 AM8/9/16
to django-mptt-dev
1. Are you still using django 1.8? If so, how long do you expect to be using it for?
No; currently on 1.9 and will update to 1.10 when django-mptt add support :)

2. Are you using or planning to use TreeManager.delay_mptt_updates() or .disable_mptt_updates()?
No

3. We're considering removing the ability to customise the names of mptt fields. (i.e. the fields will be hardcoded to names (lft, rght, tree_id, level, parent). Would this be a problem for you?
I haven't customised the names of the django-mptt fields but I do reference them in my codebase so ideally they wouldn't be renamed even if they do become hardcoded. Ideally they won't be made private in a sense as I'd want to continue to use them for some queries; e.g `level=3`.
Also I have set a `related_name` and `related_query_name` on my `parent` field. I don't actually make use of these in my codebase and instead use `get_children()` for example so if they changed it shouldn't affect myself. Thought I'd make you aware though incase it affected your decision making or brings anything else to light.

Keep up the great work :)

Thanks guys,
James

Christian Ledermann

unread,
Sep 11, 2016, 7:02:22 AM9/11/16
to django-mptt-dev


On Thursday, 28 July 2016 23:28:16 UTC+1, Craig de Stigter wrote:
Hi folks

This is a call for feedback on some changes we'd like to make to django-mptt. I'd like to gather answers to the following questions:

Questions:
1. Are you still using django 1.8? If so, how long do you expect to be using it for?

Yes.
As 1.8 is an LTS that will be supported until 04/2018 I think that some wil use this version as well.
 


2. Are you using or planning to use TreeManager.delay_mptt_updates() or .disable_mptt_updates()?

No, I can live without them 
 

3. We're considering removing the ability to customise the names of mptt fields. (i.e. the fields will be hardcoded to names (lft, rght, tree_id, level, parent). Would this be a problem for you?


No Problem this is fine with me.
Reply all
Reply to author
Forward
0 new messages