diff --git a/temba/airtime/views.py b/temba/airtime/views.py index 2fd0eb8c6a5..fcceaf0996f 100644 --- a/temba/airtime/views.py +++ b/temba/airtime/views.py @@ -6,7 +6,7 @@ from temba.airtime.models import AirtimeTransfer from temba.contacts.models import URN, ContactURN -from temba.orgs.mixins import OrgObjPermsMixin, OrgPermsMixin +from temba.orgs.views.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.request_logs.models import HTTPLog from temba.utils.views import SpaMixin diff --git a/temba/api/v2/views.py b/temba/api/v2/views.py index e9a2ab45572..6f83ac54b56 100644 --- a/temba/api/v2/views.py +++ b/temba/api/v2/views.py @@ -21,8 +21,8 @@ from temba.globals.models import Global from temba.locations.models import AdminBoundary, BoundaryAlias from temba.msgs.models import Broadcast, BroadcastMsgCount, Label, LabelCount, Media, Msg, OptIn, SystemLabel -from temba.orgs.mixins import OrgPermsMixin from temba.orgs.models import OrgMembership, User +from temba.orgs.views.mixins import OrgPermsMixin from temba.tickets.models import Ticket, TicketCount, Topic from temba.utils import str_to_bool from temba.utils.uuid import is_uuid diff --git a/temba/archives/views.py b/temba/archives/views.py index cdb2c7cb25c..a4fb9adb285 100644 --- a/temba/archives/views.py +++ b/temba/archives/views.py @@ -4,7 +4,7 @@ from django.http import HttpResponseRedirect -from temba.orgs.mixins import OrgObjPermsMixin, OrgPermsMixin +from temba.orgs.views.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.utils.views import SpaMixin from .models import Archive diff --git a/temba/campaigns/views.py b/temba/campaigns/views.py index 3003cc1f872..6577293c720 100644 --- a/temba/campaigns/views.py +++ b/temba/campaigns/views.py @@ -11,9 +11,9 @@ from temba.contacts.models import ContactField, ContactGroup from temba.flows.models import Flow from temba.msgs.models import Msg -from temba.orgs.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.orgs.views import ModalMixin -from temba.orgs.views_base import BaseListView, BaseMenuView +from temba.orgs.views.base import BaseListView, BaseMenuView +from temba.orgs.views.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.utils import languages from temba.utils.fields import CompletionTextarea, InputWidget, SelectWidget, TembaChoiceField from temba.utils.views import BulkActionMixin, ContentMenuMixin, SpaMixin diff --git a/temba/channels/types/plivo/views.py b/temba/channels/types/plivo/views.py index f5ba611fd77..4c8cc70334e 100644 --- a/temba/channels/types/plivo/views.py +++ b/temba/channels/types/plivo/views.py @@ -13,7 +13,7 @@ from temba.channels.models import Channel from temba.channels.views import BaseClaimNumberMixin, ChannelTypeMixin, ClaimViewMixin -from temba.orgs.mixins import OrgPermsMixin +from temba.orgs.views.mixins import OrgPermsMixin from temba.utils import countries from temba.utils.fields import SelectWidget from temba.utils.http import http_headers diff --git a/temba/channels/types/twilio/views.py b/temba/channels/types/twilio/views.py index beacd6857b2..1916ea3b2d9 100644 --- a/temba/channels/types/twilio/views.py +++ b/temba/channels/types/twilio/views.py @@ -13,7 +13,7 @@ from django.urls import reverse from django.utils.translation import gettext_lazy as _ -from temba.orgs.mixins import OrgPermsMixin +from temba.orgs.views.mixins import OrgPermsMixin from temba.utils import countries from temba.utils.fields import InputWidget, SelectWidget from temba.utils.timezones import timezone_to_country_code diff --git a/temba/channels/types/vonage/views.py b/temba/channels/types/vonage/views.py index c44771588fd..8ae2e5504a1 100644 --- a/temba/channels/types/vonage/views.py +++ b/temba/channels/types/vonage/views.py @@ -7,7 +7,7 @@ from django.urls import reverse from django.utils.translation import gettext_lazy as _ -from temba.orgs.mixins import OrgPermsMixin +from temba.orgs.views.mixins import OrgPermsMixin from temba.utils import countries from temba.utils.fields import InputWidget, SelectWidget from temba.utils.models import generate_uuid diff --git a/temba/channels/types/whatsapp/views.py b/temba/channels/types/whatsapp/views.py index 199ddb05ff7..95c3e76aa95 100644 --- a/temba/channels/types/whatsapp/views.py +++ b/temba/channels/types/whatsapp/views.py @@ -10,8 +10,8 @@ from django.utils.translation import gettext_lazy as _ from temba.channels.views import ChannelTypeMixin -from temba.orgs.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.orgs.views import ModalMixin +from temba.orgs.views.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.utils.fields import InputWidget from temba.utils.text import truncate from temba.utils.views import ContentMenuMixin diff --git a/temba/channels/views.py b/temba/channels/views.py index e4710f40f33..bbb4e9e561c 100644 --- a/temba/channels/views.py +++ b/temba/channels/views.py @@ -35,8 +35,8 @@ from temba.ivr.models import Call from temba.msgs.models import Msg from temba.notifications.views import NotificationTargetMixin -from temba.orgs.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.orgs.views import DependencyDeleteModal, ModalMixin +from temba.orgs.views.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.utils import countries from temba.utils.fields import SelectWidget from temba.utils.json import EpochEncoder diff --git a/temba/classifiers/views.py b/temba/classifiers/views.py index 2f178b9f65d..3adf0fa9903 100644 --- a/temba/classifiers/views.py +++ b/temba/classifiers/views.py @@ -5,8 +5,8 @@ from django.urls import reverse from django.utils.translation import gettext_lazy as _ -from temba.orgs.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.orgs.views import DependencyDeleteModal +from temba.orgs.views.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.utils.views import ComponentFormMixin, ContentMenuMixin, SpaMixin from .models import Classifier diff --git a/temba/contacts/views.py b/temba/contacts/views.py index 201fd9c3091..64e2d45e1dc 100644 --- a/temba/contacts/views.py +++ b/temba/contacts/views.py @@ -25,10 +25,10 @@ from temba.channels.models import Channel from temba.mailroom.events import Event from temba.notifications.views import NotificationTargetMixin -from temba.orgs.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.orgs.models import User from temba.orgs.views import BaseExportView, DependencyDeleteModal, DependencyUsagesModal, ModalMixin -from temba.orgs.views_base import BaseMenuView +from temba.orgs.views.base import BaseMenuView +from temba.orgs.views.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.tickets.models import Ticket, Topic from temba.utils import json, on_transaction_commit from temba.utils.dates import datetime_to_timestamp, timestamp_to_datetime diff --git a/temba/dashboard/views.py b/temba/dashboard/views.py index f374073fc3a..980e774ba04 100644 --- a/temba/dashboard/views.py +++ b/temba/dashboard/views.py @@ -9,8 +9,8 @@ from django.utils.translation import gettext_lazy as _ from temba.channels.models import Channel, ChannelCount -from temba.orgs.mixins import OrgPermsMixin from temba.orgs.models import Org +from temba.orgs.views.mixins import OrgPermsMixin from temba.utils.views import SpaMixin flattened_colors = [ diff --git a/temba/flows/views.py b/temba/flows/views.py index 71b63488190..8dbe3030e09 100644 --- a/temba/flows/views.py +++ b/temba/flows/views.py @@ -34,10 +34,10 @@ from temba.flows.models import Flow, FlowRevision, FlowRun, FlowSession, FlowStart from temba.flows.tasks import update_session_wait_expires from temba.ivr.models import Call -from temba.orgs.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.orgs.models import IntegrationType, Org from temba.orgs.views import BaseExportView, DependencyDeleteModal, ModalMixin -from temba.orgs.views_base import BaseListView, BaseMenuView +from temba.orgs.views.base import BaseListView, BaseMenuView +from temba.orgs.views.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.triggers.models import Trigger from temba.utils import analytics, gettext, json, languages, on_transaction_commit from temba.utils.fields import ( diff --git a/temba/globals/views.py b/temba/globals/views.py index b6593735dca..1c8f81f7567 100644 --- a/temba/globals/views.py +++ b/temba/globals/views.py @@ -5,8 +5,8 @@ from django import forms from django.urls import reverse -from temba.orgs.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.orgs.views import DependencyDeleteModal, DependencyUsagesModal, ModalMixin +from temba.orgs.views.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.utils.fields import InputWidget from temba.utils.views import ContentMenuMixin, SpaMixin diff --git a/temba/locations/views.py b/temba/locations/views.py index 1e82ad5a5bc..4c7615eaebc 100644 --- a/temba/locations/views.py +++ b/temba/locations/views.py @@ -8,7 +8,7 @@ from django.views.decorators.csrf import csrf_exempt from temba.locations.models import AdminBoundary, BoundaryAlias -from temba.orgs.mixins import OrgPermsMixin +from temba.orgs.views.mixins import OrgPermsMixin from temba.utils import json from temba.utils.views import ContentMenuMixin, SpaMixin diff --git a/temba/msgs/views.py b/temba/msgs/views.py index 79282d55015..52faf827845 100644 --- a/temba/msgs/views.py +++ b/temba/msgs/views.py @@ -20,10 +20,10 @@ from temba import mailroom from temba.archives.models import Archive from temba.mailroom.client.types import Exclusions -from temba.orgs.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.orgs.models import Org from temba.orgs.views import BaseExportView, DependencyDeleteModal, DependencyUsagesModal, ModalMixin -from temba.orgs.views_base import BaseListView, BaseMenuView +from temba.orgs.views.base import BaseListView, BaseMenuView +from temba.orgs.views.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.schedules.views import ScheduleFormMixin from temba.templates.models import Template, TemplateTranslation from temba.utils import json, languages diff --git a/temba/notifications/views.py b/temba/notifications/views.py index 2358005115b..fa93c64a6f7 100644 --- a/temba/notifications/views.py +++ b/temba/notifications/views.py @@ -2,7 +2,7 @@ from django.utils.translation import gettext_lazy as _ -from temba.orgs.mixins import OrgPermsMixin +from temba.orgs.views.mixins import OrgPermsMixin from temba.utils.views import SpaMixin from .mixins import NotificationTargetMixin diff --git a/temba/orgs/views/__init__.py b/temba/orgs/views/__init__.py new file mode 100644 index 00000000000..360d6f84458 --- /dev/null +++ b/temba/orgs/views/__init__.py @@ -0,0 +1 @@ +from .views import * # noqa diff --git a/temba/orgs/views_base.py b/temba/orgs/views/base.py similarity index 100% rename from temba/orgs/views_base.py rename to temba/orgs/views/base.py diff --git a/temba/orgs/forms.py b/temba/orgs/views/forms.py similarity index 99% rename from temba/orgs/forms.py rename to temba/orgs/views/forms.py index 10f35c9d601..1f07abc0ee4 100644 --- a/temba/orgs/forms.py +++ b/temba/orgs/views/forms.py @@ -10,7 +10,7 @@ from temba.utils.fields import InputWidget from temba.utils.timezones import TimeZoneFormField -from .models import Org, User +from ..models import Org, User class SignupForm(forms.ModelForm): diff --git a/temba/orgs/mixins.py b/temba/orgs/views/mixins.py similarity index 100% rename from temba/orgs/mixins.py rename to temba/orgs/views/mixins.py diff --git a/temba/orgs/views.py b/temba/orgs/views/views.py similarity index 99% rename from temba/orgs/views.py rename to temba/orgs/views/views.py index 064d6865b0a..aaac9fc3967 100644 --- a/temba/orgs/views.py +++ b/temba/orgs/views/views.py @@ -72,9 +72,7 @@ StaffOnlyMixin, ) -from .forms import SignupForm, SMTPForm -from .mixins import InferOrgMixin, OrgObjPermsMixin, OrgPermsMixin -from .models import ( +from ..models import ( BackupToken, DefinitionExport, Export, @@ -86,7 +84,9 @@ User, UserSettings, ) -from .views_base import BaseMenuView +from .base import BaseMenuView +from .forms import SignupForm, SMTPForm +from .mixins import InferOrgMixin, OrgObjPermsMixin, OrgPermsMixin # session key for storing a two-factor enabled user's id once we've checked their password TWO_FACTOR_USER_SESSION_KEY = "_two_factor_user_id" diff --git a/temba/request_logs/views.py b/temba/request_logs/views.py index 1c19f013bc0..59d0d9ce310 100644 --- a/temba/request_logs/views.py +++ b/temba/request_logs/views.py @@ -7,7 +7,7 @@ from temba.channels.models import Channel from temba.classifiers.models import Classifier -from temba.orgs.mixins import OrgObjPermsMixin, OrgPermsMixin +from temba.orgs.views.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.utils import str_to_bool from temba.utils.views import ContentMenuMixin, SpaMixin diff --git a/temba/templates/views.py b/temba/templates/views.py index 1cf1aa235b6..e8a92728b6a 100644 --- a/temba/templates/views.py +++ b/temba/templates/views.py @@ -1,7 +1,7 @@ from smartmin.views import SmartCRUDL, SmartListView, SmartReadView -from temba.orgs.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.orgs.views import DependencyUsagesModal +from temba.orgs.views.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.utils.views import SpaMixin from .models import Template, TemplateTranslation diff --git a/temba/tickets/views.py b/temba/tickets/views.py index c8fa04f1a9b..ece526d474d 100644 --- a/temba/tickets/views.py +++ b/temba/tickets/views.py @@ -20,9 +20,9 @@ from temba.msgs.models import Msg from temba.notifications.views import NotificationTargetMixin -from temba.orgs.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.orgs.views import BaseExportView, ModalMixin -from temba.orgs.views_base import BaseMenuView +from temba.orgs.views.base import BaseMenuView +from temba.orgs.views.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.utils.dates import datetime_to_timestamp, timestamp_to_datetime from temba.utils.export import response_from_workbook from temba.utils.fields import InputWidget diff --git a/temba/triggers/views.py b/temba/triggers/views.py index e1c6454e012..b14fbbbd620 100644 --- a/temba/triggers/views.py +++ b/temba/triggers/views.py @@ -15,8 +15,8 @@ from temba.flows.models import Flow from temba.formax import FormaxMixin from temba.msgs.views import ModalMixin -from temba.orgs.mixins import OrgObjPermsMixin, OrgPermsMixin -from temba.orgs.views_base import BaseListView, BaseMenuView +from temba.orgs.views.base import BaseListView, BaseMenuView +from temba.orgs.views.mixins import OrgObjPermsMixin, OrgPermsMixin from temba.schedules.models import Schedule from temba.utils.fields import SelectMultipleWidget, SelectWidget, TembaChoiceField, TembaMultipleChoiceField from temba.utils.views import BulkActionMixin, ComponentFormMixin, ContentMenuMixin, SpaMixin diff --git a/temba/utils/whatsapp/views.py b/temba/utils/whatsapp/views.py index 36f43288dba..bae94373d46 100644 --- a/temba/utils/whatsapp/views.py +++ b/temba/utils/whatsapp/views.py @@ -4,7 +4,7 @@ from temba.channels.models import Channel from temba.channels.views import ChannelTypeMixin -from temba.orgs.mixins import OrgPermsMixin +from temba.orgs.views.mixins import OrgPermsMixin from temba.utils.views import PostOnlyMixin from .tasks import refresh_whatsapp_contacts