django-clerk-users 0.1.1__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/PKG-INFO +1 -1
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/pyproject.toml +1 -1
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/utils.py +34 -7
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/uv.lock +1 -1
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/.flake8 +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/.github/workflows/main.yaml +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/.gitignore +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/.pre-commit-config.yaml +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/.python-version +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/CLAUDE.md +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/HYBRID_AUTH.md +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/LICENSE +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/README.md +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/README.md +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/TESTING.md +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/backend/.env.example +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/backend/.gitignore +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/backend/api/__init__.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/backend/api/admin.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/backend/api/apps.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/backend/api/migrations/__init__.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/backend/api/models.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/backend/api/tests.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/backend/api/urls.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/backend/api/views.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/backend/backend/__init__.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/backend/backend/asgi.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/backend/backend/settings.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/backend/backend/urls.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/backend/backend/wsgi.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/backend/manage.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/e2e/fixtures/test-users.ts +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/e2e/global-setup.ts +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/e2e/package.json +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/e2e/playwright.config.ts +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/e2e/scripts/setup-test-users.ts +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/e2e/tests/auth.spec.ts +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/e2e/tests/protected-api.spec.ts +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/e2e/tsconfig.json +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/frontend/.env.example +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/frontend/.gitignore +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/frontend/.nvmrc +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/frontend/README.md +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/frontend/eslint.config.js +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/frontend/index.html +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/frontend/package-lock.json +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/frontend/package.json +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/frontend/public/vite.svg +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/frontend/src/App.css +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/frontend/src/App.jsx +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/frontend/src/assets/react.svg +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/frontend/src/index.css +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/frontend/src/main.jsx +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/frontend/vite.config.js +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/rav.yaml +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/__init__.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/apps.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/authentication/__init__.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/authentication/backends.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/authentication/drf.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/authentication/utils.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/caching.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/checks.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/client.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/decorators.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/exceptions.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/management/__init__.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/management/commands/__init__.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/management/commands/migrate_users_to_clerk.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/management/commands/sync_clerk_organizations.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/management/commands/sync_clerk_users.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/managers.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/middleware/__init__.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/middleware/auth.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/migrations/0001_initial.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/migrations/0002_make_clerk_id_nullable.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/migrations/__init__.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/models.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/organizations/__init__.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/organizations/admin.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/organizations/apps.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/organizations/middleware.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/organizations/migrations/0001_initial.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/organizations/migrations/__init__.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/organizations/models.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/organizations/webhooks.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/settings.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/testing.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/webhooks/__init__.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/webhooks/handlers.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/webhooks/security.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/webhooks/signals.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/webhooks/views.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/tests/__init__.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/tests/settings.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/tests/test_authentication.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/tests/test_caching.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/tests/test_decorators.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/tests/test_drf.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/tests/test_hybrid_auth.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/tests/test_import.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/tests/test_middleware.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/tests/test_models.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/tests/test_organizations.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/tests/test_testing.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/tests/test_utils.py +0 -0
- {django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/tests/test_webhooks.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: django-clerk-users
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Integrate Clerk with Django
|
|
5
5
|
Project-URL: Changelog, https://github.com/jmitchel3/django-clerk-users
|
|
6
6
|
Project-URL: Documentation, https://github.com/jmitchel3/django-clerk-users
|
|
@@ -28,7 +28,9 @@ def update_or_create_clerk_user(
|
|
|
28
28
|
Update or create a Django user from Clerk data.
|
|
29
29
|
|
|
30
30
|
Fetches user data from the Clerk API and creates or updates
|
|
31
|
-
the corresponding Django user.
|
|
31
|
+
the corresponding Django user. If a user with the same email
|
|
32
|
+
already exists (e.g., a superuser created via createsuperuser),
|
|
33
|
+
it will be linked to the Clerk ID rather than creating a duplicate.
|
|
32
34
|
|
|
33
35
|
Args:
|
|
34
36
|
clerk_user_id: The Clerk user ID.
|
|
@@ -70,17 +72,42 @@ def update_or_create_clerk_user(
|
|
|
70
72
|
|
|
71
73
|
# Prepare user data
|
|
72
74
|
user_data = {
|
|
73
|
-
"email": primary_email,
|
|
74
75
|
"first_name": getattr(clerk_user, "first_name", "") or "",
|
|
75
76
|
"last_name": getattr(clerk_user, "last_name", "") or "",
|
|
76
77
|
"image_url": getattr(clerk_user, "image_url", "") or "",
|
|
77
78
|
}
|
|
78
79
|
|
|
79
|
-
#
|
|
80
|
-
user
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
# First, try to find by clerk_id
|
|
81
|
+
user = User.objects.filter(clerk_id=clerk_user_id).first()
|
|
82
|
+
created = False
|
|
83
|
+
|
|
84
|
+
if user:
|
|
85
|
+
# Update existing Clerk-linked user
|
|
86
|
+
for key, value in user_data.items():
|
|
87
|
+
setattr(user, key, value)
|
|
88
|
+
user.email = primary_email
|
|
89
|
+
user.save()
|
|
90
|
+
else:
|
|
91
|
+
# No user with this clerk_id - check if email already exists
|
|
92
|
+
user = User.objects.filter(email__iexact=primary_email).first()
|
|
93
|
+
|
|
94
|
+
if user:
|
|
95
|
+
# Link existing Django user to Clerk
|
|
96
|
+
user.clerk_id = clerk_user_id
|
|
97
|
+
for key, value in user_data.items():
|
|
98
|
+
setattr(user, key, value)
|
|
99
|
+
user.save()
|
|
100
|
+
logger.info(
|
|
101
|
+
f"Linked existing user {user.email} to Clerk ID {clerk_user_id}"
|
|
102
|
+
)
|
|
103
|
+
else:
|
|
104
|
+
# Create new user
|
|
105
|
+
user = User.objects.create(
|
|
106
|
+
clerk_id=clerk_user_id,
|
|
107
|
+
email=primary_email,
|
|
108
|
+
**user_data,
|
|
109
|
+
)
|
|
110
|
+
created = True
|
|
84
111
|
|
|
85
112
|
# Update cache
|
|
86
113
|
set_cached_user(clerk_user_id, user)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/README.md
RENAMED
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/TESTING.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/e2e/package.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/examples/django_react_example/frontend/.nvmrc
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/authentication/drf.py
RENAMED
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/authentication/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/management/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/middleware/__init__.py
RENAMED
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/middleware/auth.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/migrations/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/organizations/admin.py
RENAMED
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/organizations/apps.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/organizations/models.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/webhooks/__init__.py
RENAMED
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/webhooks/handlers.py
RENAMED
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/webhooks/security.py
RENAMED
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/webhooks/signals.py
RENAMED
|
File without changes
|
{django_clerk_users-0.1.1 → django_clerk_users-0.1.2}/src/django_clerk_users/webhooks/views.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|