Skip to content

Commit

Permalink
Add feature: DRF Permission Class
Browse files Browse the repository at this point in the history
  • Loading branch information
thubamamba committed Sep 12, 2024
1 parent f92e22e commit 3b7a3f1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 35 deletions.
5 changes: 2 additions & 3 deletions django_test_app/companies/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from django.db import migrations, models
from django_tenants.postgresql_backend.base import (
_check_schema_name as check_schema_name,
)
from django_tenants.postgresql_backend.base import \
_check_schema_name as check_schema_name


class Migration(migrations.Migration):
Expand Down
6 changes: 2 additions & 4 deletions tenant_users/tenants/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
from django_tenants.models import TenantMixin
from django_tenants.utils import get_public_schema_name, get_tenant_model

from tenant_users.permissions.models import (
PermissionsMixinFacade,
UserTenantPermissions,
)
from tenant_users.permissions.models import (PermissionsMixinFacade,
UserTenantPermissions)

# An existing user removed from a tenant
tenant_user_removed = Signal()
Expand Down
14 changes: 5 additions & 9 deletions tenant_users/tenants/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import transaction
from django_tenants.utils import (
get_multi_type_database_field_name,
get_public_schema_name,
get_tenant_domain_model,
get_tenant_model,
get_tenant_types,
has_multi_type_tenants,
schema_context,
)
from django_tenants.utils import (get_multi_type_database_field_name,
get_public_schema_name,
get_tenant_domain_model, get_tenant_model,
get_tenant_types, has_multi_type_tenants,
schema_context)

from tenant_users.tenants.models import ExistsError, InactiveError, SchemaError

Expand Down
12 changes: 4 additions & 8 deletions tenant_users/tenants/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@

from django.contrib.auth import get_user_model
from django.db import connection
from django_tenants.utils import (
get_multi_type_database_field_name,
get_public_schema_name,
get_tenant_domain_model,
get_tenant_model,
get_tenant_types,
has_multi_type_tenants,
)
from django_tenants.utils import (get_multi_type_database_field_name,
get_public_schema_name,
get_tenant_domain_model, get_tenant_model,
get_tenant_types, has_multi_type_tenants)

from tenant_users.tenants.models import ExistsError, SchemaError

Expand Down
3 changes: 2 additions & 1 deletion tests/test_tenants/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
from django_tenants.utils import get_tenant_model

from tenant_users.tenants.models import ExistsError, InactiveError
from tenant_users.tenants.tasks import INACTIVE_USER_ERROR_MESSAGE, provision_tenant
from tenant_users.tenants.tasks import (INACTIVE_USER_ERROR_MESSAGE,
provision_tenant)

#: Constants
TenantModel = get_tenant_model()
Expand Down
14 changes: 4 additions & 10 deletions tests/test_tenants/test_tenants_models.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import pytest
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, Permission
from django_tenants.utils import (
get_public_schema_name,
get_tenant_model,
tenant_context,
)
from django_tenants.utils import (get_public_schema_name, get_tenant_model,
tenant_context)

from tenant_users.permissions.models import UserTenantPermissions
from tenant_users.tenants.models import (
TENANT_DELETE_ERROR_MESSAGE,
DeleteError,
ExistsError,
)
from tenant_users.tenants.models import (TENANT_DELETE_ERROR_MESSAGE,
DeleteError, ExistsError)
from tenant_users.tenants.tasks import provision_tenant

#: Constants
Expand Down

0 comments on commit 3b7a3f1

Please sign in to comment.