Skip to content

Commit

Permalink
Reorg all view stuff in the orgs app into a views package
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Oct 3, 2024
1 parent e1a133a commit d1b8144
Show file tree
Hide file tree
Showing 27 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion temba/airtime/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion temba/api/v2/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion temba/archives/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions temba/campaigns/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion temba/channels/types/plivo/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion temba/channels/types/twilio/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion temba/channels/types/vonage/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion temba/channels/types/whatsapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion temba/channels/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion temba/classifiers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions temba/contacts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion temba/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
4 changes: 2 additions & 2 deletions temba/flows/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion temba/globals/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion temba/locations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions temba/msgs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion temba/notifications/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions temba/orgs/views/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .views import * # noqa
File renamed without changes.
2 changes: 1 addition & 1 deletion temba/orgs/forms.py → temba/orgs/views/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions temba/orgs/views.py → temba/orgs/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion temba/request_logs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion temba/templates/views.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions temba/tickets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions temba/triggers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion temba/utils/whatsapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d1b8144

Please sign in to comment.