Skip to content

Conversation

@singleton11
Copy link
Contributor

@singleton11 singleton11 commented Jan 9, 2017

If PolymorphicTreeForeignKey field name has name which different from 'parent' there was an error in admin
Added test for case above
Actualized tox and travis configs
Added step-by-step instruction to readme how to run tests
Adjusted supported version list in readme

@codecov-io
Copy link

codecov-io commented Jan 9, 2017

Current coverage is 54.87% (diff: 98.76%)

Merging #57 into master will increase coverage by 9.55%

@@ master #57 diff @@ ========================================== Files 12 13 +1 Lines 631 707 +76 Methods 0 0 Messages 0 0 Branches 0 0 ========================================== + Hits 286 388 +102  + Misses 345 319 -26  Partials 0 0 

Powered by Codecov. Last update 61debd4...06e26a0

@singleton11
Copy link
Contributor Author

Added possibility to make validation before move node in admin through can_be_moved method of PolymorphicMPTTModel overriding. This method calls in admin, and if there are exceptions during execution, error response returns

@vdboor vdboor merged commit ec885e3 into django-polymorphic:master Jan 11, 2017
@vdboor
Copy link
Member

vdboor commented Jan 11, 2017

Thanks for this wonderful work!

@vdboor
Copy link
Member

vdboor commented Jan 11, 2017

@singleton11 I do wonder, is can_be_moved() needed? For example, there is already can_have_children() which does about the same thing. Where are you using that hook for?

I've also merged some other fixes, so please merge/rebase before you add a new fix ;-)

vdboor added a commit that referenced this pull request Jan 11, 2017
Renamed can_move_to() to `validate_move_to()` (cc #57).
@vdboor
Copy link
Member

vdboor commented Jan 11, 2017

@singleton11 FYI, I've renamedcan_move_to() to validate_move_to()
Since we can limit the children types now, would you still need validate_move_to() to exist?
Thanks for letting me know!

@singleton11
Copy link
Contributor Author

singleton11 commented Jan 11, 2017

@vdboor, I promise, I will send different features as separate PRs next time ;-)

mptt doesn't call clean() to check, if validation error occurs, when move_to() executed.

Yes, I need to do clean() before moving. Hovewer it's not a django-polymorhic-tree problem, therefore I made this hook. I don't know where to add clean() calling in django-mptt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants