Skip to content
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

Make TranslatableMixin for snippets not required #257

Merged
merged 2 commits into from
Dec 1, 2020

Conversation

Vadim-Karpenko
Copy link
Contributor

The snippets that do not have the TranslatableMixin or any translation features on it do not work due to an error message (see image below)
This update fixes the "Nonetype" object has no attribute is_shown error.
Here is an error message -
image

The snippets that do not have the TranslatableMixin or any translation features on it do not work at all.
This update fixes the "Nonetype" object has no attribute is_shown.
Copy link
Contributor

@kaedroho kaedroho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this! just a comment about a simpler approach that doesn't require a dummy menu item class. Also this needs a test! (test suite for this button is here: https://github.com/wagtail/wagtail-localize/blob/master/wagtail_localize/tests/test_submit_translations.py#L489)



class DisabledTranslationSnippetActionMenuItem():
def is_shown(self, request, context):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be simpler to move the if issubclass(model, TranslatableMixin): check itself into the is_shown method on RestartTranslationSnippetActionMenuItem and then make the hook always return a RestartTranslationSnippetActionMenuItem?

@kaedroho
Copy link
Contributor

kaedroho commented Dec 1, 2020

Fixes #265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants