-
Notifications
You must be signed in to change notification settings - Fork 49
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
Remove views from existing projects on view update #431
Conversation
Thanks @m6121 , we need to talk about this though. We have a few more cases we should treat the same: views can be restricted to sites and groups as well. Also the same goes for tasks. On the technical level, maybe a post_save signal for View would be better, since it also triggers when the view is updated through the admin interface. |
Hi @jochenklar, I refactored the code to cover the three dependencies and implemented a configuration flag in order to enable this feature. However, the tests did not yet cover all possible cases. I employed the m2m_changed signal which is connected in the |
I added some tests and fixed the logic and think this is in a status worth a review, especially the implemented logic. |
Hey @m6121 , thanks a lot, looks good, I added a few (minor) comments inline. I wonder if we should move the signals and handlers to the
and not import In another project I put the handlers in a separate file |
Oh and it would be good if you indent the fixtures with 2 spaces and the rest with 4 spaces. I have a trailing white space plugin and a flake8 plugin in my editor which makes me even more pedantic! |
if settings.PROJECT_REMOVE_VIEWS: | ||
from . import handlers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the implementation into the projects
app. I think this makes sense as you suggested. Furthermore, I also moved it from signals.py
to handlers.py
. However, I am not happy with the linking into the projects/apps.py
due to the configuration flag.
I also adjusted the indentation to two spaces. The formatting that I originally committed was created using the djangoadmin-command as we proposed here: https://github.com/rdmorganiser/rdmo/blob/master/docs/dev.md
Even when using |
Hi @jochenklar, thanks a lot for your review! Hope I addressed all comments. Not sure if we should change the import of the handlers to be more independent of the feature flag. Despite this, I think it is ready for a review. |
I think the dumping commands in the |
Remove views from existing projects on view update
This PR aims at fixing #345 by automatically updating existing projects on saving of views. I added a separate view and project in the test-data in order to test this case.