-
Notifications
You must be signed in to change notification settings - Fork 21
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
Unable to delete a page after running an A/B test #90
Comments
This is inadvertent behaviour since #54, which marked the page revision an ab test references as protected to prevent Wagtail's When deleting a page, Wagtail will try to delete all revisions along with it which we are trying to prevent to avoid data loss but should allow in this case. We should show some sort of confirmation view when deleting a page that has ab tests. We can use the I think this best be solved by:
Workaround@danielfmiranda as a temporary workaround, I think you can define a from wagtail.models import Page
class MyPageType(Page):
def delete(self, *args, **kwargs):
self.ab_tests.all().delete()
return super().delete(*args, **kwargs) |
I was able to reproduce this issue and I'm trying to work on it. Also found that the time when the test was created is shown in different timezone. Time difference can be seen in my taskbar and the time in the test page. Although this should be addressed in a separate issue, let me know if I should raise an issue for that. |
Let me know if this is going in the right direction. Screencast.From.2024-12-13.09-37-07.1.mp4I used a hook with before_delete_page that shows the new view and when clicked proceed it deletes the ab tests and redirects to the original confirm_delete_page view. |
This looks great @joelwilliam2005! Thank you very much for working on this ❤️ The table format makes sense to me, but I would suggest the following order of columns for the table:
By default, the tests should be ordered by descending first_started_date (most recently created tests first, oldest tests last) I would also change the wording of the confirmation to make it clear the data is lost forever and cannot be restored.
Not sure if we if and for what permissions this should account. @danielfmiranda do you have input for us on this? |
@joelwilliam2005 looks amazing! Please raise a PR against wagtail-ab-testing so every project using ab-testing automatically gets this nice overview when deleting a page😄 |
If I start an A/B test for a page and then attempt to delete it once the AB test has concluded, I am met with a 500 error mentioning "("Cannot delete some instances of model 'Page' because they are referenced through protected foreign keys: '<Page_Model>.page_ptr'.", {<AbTest: AbTest object (2)>})"
The text was updated successfully, but these errors were encountered: