Skip to content

Commit

Permalink
Use original Model save bound method
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Sep 6, 2024
1 parent 52e60fd commit 6c6ad35
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions djangocms_blog/migrations/0044_copy_plugins.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import migrations, models


Expand All @@ -9,12 +8,12 @@ def __init__(self, model):
self.model = model

def __enter__(self):
self.save_method = self.model.save
self.model.save = lambda self, *args, **kwargs: super(models.Model, self).save(*args, **kwargs)
self.original_save_method = self.model.save
self.model.save = models.Model.save
return self.model

def __exit__(self, exc_type, exc_value, traceback):
self.model.save = self.save_method
self.model.save = self.original_save_method


def move_plugins_to_blog_content(apps, schema_editor):
Expand Down

0 comments on commit 6c6ad35

Please sign in to comment.