django-cms / djangocms-frontend

django CMS frontend is a plugin bundle for django CMS providing several components for the frontend, currently implemented with the popular Bootstrap 5 framework.
Other
43 stars 20 forks source link

Problem with code plugin after migrate from B4 to B5 #143

Closed TLuesebrinck closed 11 months ago

TLuesebrinck commented 11 months ago

Edit a page with a code plugin inside cause an exception:

'CodeBlock' object has no attribute 'code_type' /usr/share/django-cms/env/lib/python3.9/site-packages/djangocms_frontend/models.py, line 40, in getattr

Error during template rendering In template /usr/share/django-cms/env/lib/python3.9/site-packages/cms/templates/cms/toolbar/dragitem.html, error at line 50

fsbraun commented 11 months ago

@TLuesebrinck Can you retry the migration with this repo: pip install git+https://github.com/fsbraun/djangocms-frontend@fix/code-migration#egg=djangocms-frontend? (Base of potential fix #144 )

Does this solve your problem?

TLuesebrinck commented 11 months ago

After I run frontend migrate and check the cms I get this error

Plugin instances

There are potentially serious problems with the plugins in your database. Even if your site works, you should run the 'manage.py cms list plugins' command and then the 'manage.py cms delete-orphaned-plugins' command. This will alter your database; read the documentation before using it. [ERROR]

Am Mo., 24. Juli 2023 um 20:46 Uhr schrieb Fabian Braun < @.***>:

@TLuesebrinck https://github.com/TLuesebrinck Can you retry the migration with this repo: pip install git+ @.***/code-migration#egg=djangocms-frontend? (Base of potential fix #144 https://github.com/django-cms/djangocms-frontend/pull/144 )

Does this solve your problem?

— Reply to this email directly, view it on GitHub https://github.com/django-cms/djangocms-frontend/issues/143#issuecomment-1648427280, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWMV5NS4XBGCQ7XMXE4KWCDXR27GRANCNFSM6AAAAAA2V3JUPA . You are receiving this because you were mentioned.Message ID: @.***>

fsbraun commented 11 months ago

The CodeBlockPlugin has instances but is no longer installed [ERROR] indicates that you have not included djangocms_frontend.contrib.content in INSTALLED_APPS. Could you check? If added, the checks should run w/o problems.

TLuesebrinck commented 11 months ago

no, "djangocms_frontend.contrib.content" is in the list of installed apps.

Am Di., 25. Juli 2023 um 15:43 Uhr schrieb Fabian Braun < @.***>:

The CodeBlockPlugin has instances but is no longer installed [ERROR] indicates that you have not included djangocms_frontend.contrib.content in INSTALLED_APPS. Could you check? If added, the checks should run w/o problems.

— Reply to this email directly, view it on GitHub https://github.com/django-cms/djangocms-frontend/issues/143#issuecomment-1649873687, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWMV5NUI2DZZI5XXZCRDVADXR7EPJANCNFSM6AAAAAA2V3JUPA . You are receiving this because you were mentioned.Message ID: @.***>

TLuesebrinck commented 11 months ago

maybe the name is wrong? CodePlugin instead CodeBlockPlugin?

Am Di., 25. Juli 2023 um 15:54 Uhr schrieb Thiemo Lüsebrinck < @.***>:

no, "djangocms_frontend.contrib.content" is in the list of installed apps.

Am Di., 25. Juli 2023 um 15:43 Uhr schrieb Fabian Braun < @.***>:

The CodeBlockPlugin has instances but is no longer installed [ERROR] indicates that you have not included djangocms_frontend.contrib.content in INSTALLED_APPS. Could you check? If added, the checks should run w/o problems.

— Reply to this email directly, view it on GitHub https://github.com/django-cms/djangocms-frontend/issues/143#issuecomment-1649873687, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWMV5NUI2DZZI5XXZCRDVADXR7EPJANCNFSM6AAAAAA2V3JUPA . You are receiving this because you were mentioned.Message ID: @.***>

fsbraun commented 11 months ago

It seems there is an inconsistency: The model is called CodeBlock but the plugin CodePlugin. I am wondering how to resolve this in a compatible manner.

fsbraun commented 11 months ago

@TLuesebrinck I've updated the PR repo. Can you give it another try? Now, the new plugins should be called CodePlugin and not CodeBlockPlugin.

TLuesebrinck commented 11 months ago

I have now a different problem. After installing frontend and migrate the table I have a problem with "manage.py frontend sync_permissions users" I get this error from .subcommands.migrate import Migrate File "/usr/share/django-cms/env/lib/python3.9/site-packages/djangocms_frontend/management/commands/subcommands/migrate.py", line 23, in plugin_names.append(bootstrap4_migration.plugin_names) AttributeError: 'dict' object has no attribute 'append'

and cms check output: " - IconPlugin has 24 unsaved instances [ERROR]"

Am Di., 25. Juli 2023 um 16:11 Uhr schrieb Fabian Braun < @.***>:

@TLuesebrinck https://github.com/TLuesebrinck I've updated the PR repo. Can you give it another try? Now, the new plugins should be called CodePlugin and not CodeBlockPlugin.

— Reply to this email directly, view it on GitHub https://github.com/django-cms/djangocms-frontend/issues/143#issuecomment-1649922713, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWMV5NUPHAQIF5PS6UAWLD3XR7HY7ANCNFSM6AAAAAA2V3JUPA . You are receiving this because you were mentioned.Message ID: @.***>

fsbraun commented 11 months ago

@TLuesebrinck Sorry, this was a stupid mistake. Should work now.

TLuesebrinck commented 11 months ago

The code block stuff works now (nice !), but I am worried about the unsaved IconPlugins. The migration manual say execute "manage.py cms delete-orphaned -plugins" so it simply deletes the icon plugins?

Am Di., 25. Juli 2023 um 16:48 Uhr schrieb Fabian Braun < @.***>:

@TLuesebrinck https://github.com/TLuesebrinck Sorry, this was a stupid mistake. Should work now.

— Reply to this email directly, view it on GitHub https://github.com/django-cms/djangocms-frontend/issues/143#issuecomment-1649988276, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWMV5NUDNMIWV45QATLT53LXR7MDRANCNFSM6AAAAAA2V3JUPA . You are receiving this because you were mentioned.Message ID: @.***>

fsbraun commented 11 months ago

I am not sure what the issue with the IconPlugin is. I assume you want to switch to djangocms_frontend.contrib.icon. Can you check your database if there is a table djangocms_icon_icon and if it still contains rows?

Maybe the error messages in the previous processes left some data?

Is djangocms_icon still in INSTALLED_APPS? I believe djangocms_icon needs to be in INSTALLED_APPS when migrating and be removed later.

TLuesebrinck commented 11 months ago

I allways started from scratch with an DB with Bootstrap 4 plugins. The DB contains djangocms_icon_icon with 24 rows. At the end of the porces they are gone.

Maybe I did it wrong? When I follow the "getting started" manual I do this steps.

Extend installed apps

then: ./manage.py migrate ./manage.py frontend sync_permissions users ./manage.py frontend sync_permissions groups

then this: ./manage.py cms delete-orphaned-plugins ./manage.py migrate ./manage.py frontend migrate

The IconPlugins are orphan after the first migrate, so I asume the "cms delete-orphaned-plugins" just delete them before "frontend migrate" can do something.


Von: Fabian Braun @.> Gesendet: Dienstag, 25. Juli 2023 17:56 An: django-cms/djangocms-frontend @.> Cc: TLuesebrinck @.>; Mention @.> Betreff: Re: [django-cms/djangocms-frontend] Problem with code plugin after migrate from B4 to B5 (Issue #143)

I am not sure what the issue with the IconPlugin is. I assume you want to switch to djangocms_frontend.contrib.icon. Can you check your database if there is a table djangocms_icon_icon and if it still contains rows?

Maybe the error messages in the previous processes left some data?

— Reply to this email directly, view it on GitHubhttps://github.com/django-cms/djangocms-frontend/issues/143#issuecomment-1650106894, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWMV5NT4MDRZHBP2XRNCCYLXR7UBNANCNFSM6AAAAAA2V3JUPA. You are receiving this because you were mentioned.Message ID: @.***>

fsbraun commented 11 months ago

That seems like a reasonable process. Maybe they have been there from the beginning? Do you observe any surprises (missing icons)?

Am 25.07.2023 um 18:49 schrieb TLuesebrinck @.***>:

I allways started from scratch with an DB with Bootstrap 4 plugins. The DB contains djangocms_icon_icon with 24 rows. At the end of the porces they are gone.

Maybe I did it wrong? When I follow the "getting started" manual I do this steps.

Extend installed apps

then: ./manage.py migrate ./manage.py frontend sync_permissions users ./manage.py frontend sync_permissions groups

then this: ./manage.py cms delete-orphaned-plugins ./manage.py migrate ./manage.py frontend migrate

The IconPlugins are orphan after the first migrate, so I asume the "cms delete-orphaned-plugins" just delete them before "frontend migrate" can do something.


Von: Fabian Braun @.> Gesendet: Dienstag, 25. Juli 2023 17:56 An: django-cms/djangocms-frontend @.> Cc: TLuesebrinck @.>; Mention @.> Betreff: Re: [django-cms/djangocms-frontend] Problem with code plugin after migrate from B4 to B5 (Issue #143)

I am not sure what the issue with the IconPlugin is. I assume you want to switch to djangocms_frontend.contrib.icon. Can you check your database if there is a table djangocms_icon_icon and if it still contains rows?

Maybe the error messages in the previous processes left some data?

— Reply to this email directly, view it on GitHubhttps://github.com/django-cms/djangocms-frontend/issues/143#issuecomment-1650106894, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWMV5NT4MDRZHBP2XRNCCYLXR7UBNANCNFSM6AAAAAA2V3JUPA. You are receiving this because you were mentioned.Message ID: @.***> — Reply to this email directly, view it on GitHub https://github.com/django-cms/djangocms-frontend/issues/143#issuecomment-1650190278, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEA7CHPAFYETRWFOBDKEBFDXR72JNANCNFSM6AAAAAA2V3JUPA. You are receiving this because you commented.

TLuesebrinck commented 11 months ago

I found where in my text blocks the Icons are located. And I don't use them, I never saw them, I guess the icon loading was never correct setup. So for me, this is no problem that the icons are gone. But for other users it might be a problem.

Am Mi., 26. Juli 2023 um 11:27 Uhr schrieb Fabian Braun < @.***>:

Closed #143 https://github.com/django-cms/djangocms-frontend/issues/143 as completed via #144 https://github.com/django-cms/djangocms-frontend/pull/144.

— Reply to this email directly, view it on GitHub https://github.com/django-cms/djangocms-frontend/issues/143#event-9921490374, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWMV5NRLUU26XM5TH57UJE3XSDPG7ANCNFSM6AAAAAA2V3JUPA . You are receiving this because you were mentioned.Message ID: @.*** com>

fsbraun commented 11 months ago

OK, thanks for mentioning it! The PR is merged and I'll release as soon as I have updated translations...