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

chore: solved rule I001 #222

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions djangocms_alias/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from cms.admin.utils import GrouperModelAdmin
from cms.utils.permissions import get_model_permission_codename
from cms.utils.urlutils import admin_reverse
from django import forms
from django.contrib import admin
from django.http import (
Expand All @@ -8,11 +11,6 @@
)
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _

from cms.admin.utils import GrouperModelAdmin
from cms.utils.permissions import get_model_permission_codename
from cms.utils.urlutils import admin_reverse

from parler.admin import TranslatableAdmin

from .cms_config import AliasCMSConfig
Expand All @@ -32,7 +30,6 @@
is_versioning_enabled,
)


__all__ = [
"AliasAdmin",
"CategoryAdmin",
Expand Down
5 changes: 1 addition & 4 deletions djangocms_alias/cms_config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from cms.app_base import CMSAppConfig
from django.apps import apps
from django.conf import settings

from cms.app_base import CMSAppConfig

from .models import AliasContent, AliasPlugin, copy_alias_content
from .rendering import render_alias_content


try:
apps.get_app_config("djangocms_internalsearch")
from .internal_search import AliasContentConfig
Expand All @@ -31,7 +29,6 @@ class AliasCMSConfig(CMSAppConfig):

if djangocms_versioning_enabled:
from cms.utils.i18n import get_language_tuple

from djangocms_versioning.datastructures import VersionableItem

versioning = [
Expand Down
15 changes: 8 additions & 7 deletions djangocms_alias/cms_plugins.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
from copy import copy

from django.utils.translation import (
get_language_from_request,
gettext_lazy as _,
)

from cms.plugin_base import CMSPluginBase, PluginMenuItem
from cms.plugin_pool import plugin_pool
from cms.utils.permissions import (
Expand All @@ -13,11 +8,17 @@
)
from cms.utils.plugins import copy_plugins_to_placeholder
from cms.utils.urlutils import add_url_parameters, admin_reverse
from django.utils.translation import (
get_language_from_request,
)
from django.utils.translation import (
gettext_lazy as _,
)

from .constants import CREATE_ALIAS_URL_NAME, DETACH_ALIAS_PLUGIN_URL_NAME
from .forms import AliasPluginForm
from .models import Alias as AliasModel, AliasContent, AliasPlugin

from .models import Alias as AliasModel
from .models import AliasContent, AliasPlugin

__all__ = [
"Alias",
Expand Down
20 changes: 10 additions & 10 deletions djangocms_alias/cms_toolbars.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import itertools
from copy import copy

from django.urls import NoReverseMatch
from django.utils.encoding import force_str
from django.utils.http import urlencode
from django.utils.translation import (
get_language_from_request,
gettext,
gettext_lazy as _,
)

from cms.cms_toolbars import (
ADMIN_MENU_IDENTIFIER,
ADMINISTRATION_BREAK,
Expand All @@ -27,6 +18,16 @@
)
from cms.utils.permissions import get_model_permission_codename
from cms.utils.urlutils import add_url_parameters, admin_reverse
from django.urls import NoReverseMatch
from django.utils.encoding import force_str
from django.utils.http import urlencode
from django.utils.translation import (
get_language_from_request,
gettext,
)
from django.utils.translation import (
gettext_lazy as _,
)

from .constants import (
DELETE_ALIAS_URL_NAME,
Expand All @@ -36,7 +37,6 @@
from .models import Alias, AliasContent
from .utils import is_versioning_enabled


__all__ = [
"AliasToolbar",
]
Expand Down
6 changes: 3 additions & 3 deletions djangocms_alias/cms_wizards.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from django.utils.translation import gettext_lazy as _

from cms.utils.permissions import get_model_permission_codename
from cms.wizards.wizard_base import Wizard
from cms.wizards.wizard_pool import wizard_pool
from django.utils.translation import gettext_lazy as _

from .cms_plugins import Alias
from .forms import CreateAliasWizardForm, CreateCategoryWizardForm
from .models import Alias as AliasModel, Category
from .models import Alias as AliasModel
from .models import Category


class CreateAliasWizard(Wizard):
Expand Down
1 change: 0 additions & 1 deletion djangocms_alias/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

import django


DJANGO_GTE_21 = LooseVersion(django.get_version()) >= LooseVersion("2.1")
7 changes: 3 additions & 4 deletions djangocms_alias/filters.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from cms.forms.utils import get_sites
from django.contrib import admin
from django.utils.encoding import smart_str
from django.utils.translation import get_language, gettext_lazy as _

from cms.forms.utils import get_sites
from django.utils.translation import get_language
from django.utils.translation import gettext_lazy as _

from .cms_config import AliasCMSConfig
from .constants import (
Expand All @@ -12,7 +12,6 @@
)
from .models import Category


djangocms_versioning_enabled = AliasCMSConfig.djangocms_versioning_enabled


Expand Down
21 changes: 10 additions & 11 deletions djangocms_alias/forms.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
from cms.models import CMSPlugin, Placeholder
from cms.utils import get_current_site
from cms.utils.permissions import (
get_model_permission_codename,
has_plugin_permission,
)
from cms.utils.urlutils import admin_reverse
from django import forms
from django.contrib import admin
from django.contrib.admin.widgets import (
Expand All @@ -7,28 +14,20 @@
from django.contrib.sites.models import Site
from django.db import transaction
from django.utils.translation import gettext_lazy as _

from cms.models import CMSPlugin, Placeholder
from cms.utils import get_current_site
from cms.utils.permissions import (
get_model_permission_codename,
has_plugin_permission,
)
from cms.utils.urlutils import admin_reverse

from parler.forms import TranslatableModelForm

from .constants import CATEGORY_SELECT2_URL_NAME, SELECT2_ALIAS_URL_NAME
from .models import (
Alias,
Alias as AliasModel,
AliasContent,
AliasPlugin,
Category,
)
from .models import (
Alias as AliasModel,
)
from .utils import emit_content_change, is_versioning_enabled


__all__ = [
"AliasPluginForm",
"BaseCreateAliasForm",
Expand Down
4 changes: 1 addition & 3 deletions djangocms_alias/internal_search.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from cms.toolbar.utils import get_toolbar_from_request
from django.template import RequestContext
from django.utils.translation import gettext_lazy as _

from cms.toolbar.utils import get_toolbar_from_request

from djangocms_internalsearch.base import BaseSearchConfig
from djangocms_internalsearch.helpers import get_request, get_version_object
from haystack import indexes
Expand Down
6 changes: 3 additions & 3 deletions djangocms_alias/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Generated by Django 2.1.1 on 2018-09-07 11:12

import cms.utils.i18n
from django.db import migrations, models
from django.conf import settings
import django.db.models.deletion
import parler.models
from django.conf import settings
from django.db import migrations, models

from djangocms_alias.models import get_templates, TEMPLATE_DEFAULT
from djangocms_alias.models import TEMPLATE_DEFAULT, get_templates


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion djangocms_alias/migrations/0002_auto_20200723_1424.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Generated by Django 2.2.13 on 2020-07-23 14:24

from django.db import migrations, models
import django.db.models.deletion
import parler.fields
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion djangocms_alias/migrations/0003_auto_20230725_1547.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 4.1.8 on 2023-07-25 15:47

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 3.2.20 on 2023-07-26 13:43

from django.db import migrations, models
import django.utils.translation
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
18 changes: 8 additions & 10 deletions djangocms_alias/models.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
import operator
from collections import defaultdict

from django.conf import settings
from django.contrib.sites.models import Site
from django.db import models, transaction
from django.db.models import F, Q
from django.utils.encoding import force_str
from django.utils.functional import cached_property
from django.utils.translation import get_language, gettext_lazy as _

from cms.api import add_plugin
from cms.models import CMSPlugin, Placeholder
from cms.models.fields import PlaceholderRelationField
from cms.models.managers import WithUserMixin
from cms.toolbar.utils import get_object_preview_url
from cms.utils.plugins import copy_plugins_to_placeholder
from cms.utils.urlutils import admin_reverse

from django.conf import settings
from django.contrib.sites.models import Site
from django.db import models, transaction
from django.db.models import F, Q
from django.utils.encoding import force_str
from django.utils.functional import cached_property
from django.utils.translation import get_language
from django.utils.translation import gettext_lazy as _
from parler.models import TranslatableModel, TranslatedFields

from .constants import CHANGE_CATEGORY_URL_NAME
from .utils import is_versioning_enabled


__all__ = [
"Category",
"Alias",
Expand Down
11 changes: 4 additions & 7 deletions djangocms_alias/templatetags/djangocms_alias_tags.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
from collections import ChainMap

from django import template
from django.utils.translation import get_language

from classytags.arguments import Argument, MultiValueArgument
from classytags.core import Tag
from cms.templatetags.cms_tags import PlaceholderOptions
from cms.toolbar.utils import get_toolbar_from_request
from cms.utils import get_current_site, get_language_from_request
from cms.utils.i18n import get_default_language, get_language_list
from cms.utils.placeholder import validate_placeholder_name
from cms.utils.urlutils import add_url_parameters, admin_reverse

from classytags.arguments import Argument, MultiValueArgument
from classytags.core import Tag
from django import template
from django.utils.translation import get_language

from ..constants import (
DEFAULT_STATIC_ALIAS_CATEGORY_NAME,
Expand All @@ -20,7 +18,6 @@
from ..models import Alias, AliasContent, Category
from ..utils import is_versioning_enabled


register = template.Library()


Expand Down
3 changes: 1 addition & 2 deletions djangocms_alias/test_utils/text/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.db import models

from cms.models import CMSPlugin
from django.db import models


class Text(CMSPlugin):
Expand Down
1 change: 0 additions & 1 deletion djangocms_alias/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.urls import path


from . import constants, views # isort:skip


Expand Down
11 changes: 6 additions & 5 deletions djangocms_alias/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import json

from cms.models import Page
from cms.toolbar.utils import get_plugin_toolbar_info, get_plugin_tree_as_json
from django.contrib import admin
from django.core.exceptions import PermissionDenied
from django.db.models import Q
Expand All @@ -9,19 +11,18 @@
from django.utils.translation import (
get_language,
get_language_from_request,
)
from django.utils.translation import (
gettext_lazy as _,
)
from django.views.generic import ListView

from cms.models import Page
from cms.toolbar.utils import get_plugin_toolbar_info, get_plugin_tree_as_json

from .cms_plugins import Alias
from .forms import BaseCreateAliasForm, CreateAliasForm
from .models import Alias as AliasModel, AliasPlugin, Category
from .models import Alias as AliasModel
from .models import AliasPlugin, Category
from .utils import emit_content_change


JAVASCRIPT_SUCCESS_RESPONSE = """
<div><div class="messagelist">
<div class="success"></div>
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import djangocms_alias


CLASSIFIERS = [
"Environment :: Web Environment",
"Framework :: Django",
Expand Down
1 change: 0 additions & 1 deletion test_settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
from distutils.util import strtobool


BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
ENABLE_VERSIONING = strtobool(os.environ.get("ENABLE_VERSIONING", "1"))
EXTRA_INSTALLED_APPS = []
Expand Down
Loading
Loading