Skip to content

Commit

Permalink
Fix typo and take migration user from django-cms-4-migration package …
Browse files Browse the repository at this point in the history
…if set
  • Loading branch information
fsbraun committed Aug 26, 2024
1 parent 7fc8593 commit e0c4fdd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion djangocms_blog/cms_appconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,10 @@ def schemaorg_type(self):
return self.gplus_type

def __str__(self):
return f"{self.namespace}: {self.get_app_title()} / {self.object_name}"
try:
return f"{self.namespace}: {self.get_app_title()} / {self.object_name}"
except Exception as e:
return str(e)


def get_app_instance(request):
Expand Down
8 changes: 6 additions & 2 deletions djangocms_blog/migrations/0044_copy_plugins.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import migrations

Expand All @@ -8,9 +9,12 @@ def move_plugins_to_blog_content(apps, schema_editor):
"""Adds instances for the new model.
ATTENTION: All fields of the model must have a valid default value!"""

versioning_installed = apps.is_installed("djangocms_versisouoning")
versioning_installed = apps.is_installed("djangocms_versioning")
if versioning_installed:
migration_user = User.objects.first()
if getattr(settings, "CMS_MIGRATION_USER_ID", None):
migration_user = User.objects.get(pk=settings.CMS_MIGRATION_USER_ID)
else:
migration_user = User.objects.filter(is_superuser=True, is_acitve=True).first()
else:
migration_user = None

Expand Down

0 comments on commit e0c4fdd

Please sign in to comment.