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(deps): Upgrade to Django 4.1 #18830

Merged
merged 30 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
78d795a
Upgrade dependencies
webjunkie Nov 15, 2023
60c4351
Fix middleware error
webjunkie Nov 15, 2023
cb6b389
Upgrade psycopg
webjunkie Nov 15, 2023
f764d13
Go to Django 4.1 because of problems with psycopg3
webjunkie Nov 16, 2023
197cdc8
Update query snapshots
github-actions[bot] Nov 16, 2023
1513680
Update query snapshots
github-actions[bot] Nov 16, 2023
eabba3b
Update query snapshots
github-actions[bot] Nov 16, 2023
d0d6ee6
Update query snapshots
github-actions[bot] Nov 16, 2023
fd8212d
Switch TaggedItem tests to assert ValidationError
webjunkie Nov 16, 2023
bb8d7a5
Remove type: ignore comments
webjunkie Nov 16, 2023
faad0ca
Update query snapshots
github-actions[bot] Nov 16, 2023
a7dd0d8
Merge branch 'master' into chore/Django-4.1-upgrade
webjunkie Nov 22, 2023
d24d1b5
Update query snapshots
github-actions[bot] Nov 22, 2023
7447771
Merge branch 'master' into chore/Django-4.1-upgrade
webjunkie Nov 23, 2023
e5e59cf
remove any invalid character from k8s namespace
pauldambra Nov 28, 2023
83af146
Merge branch 'master' into chore/Django-4.1-upgrade
webjunkie Nov 29, 2023
393c044
Update query snapshots
github-actions[bot] Nov 29, 2023
236b39b
Update pr-deploy.yml
webjunkie Nov 29, 2023
671f314
Merge branch 'master' into chore/Django-4.1-upgrade
webjunkie Nov 30, 2023
b4bfab9
Run pip-compile rebuild
webjunkie Nov 30, 2023
a8e1877
Merge branch 'master' into chore/Django-4.1-upgrade
webjunkie Dec 5, 2023
26e41ee
Fix type issues
webjunkie Dec 5, 2023
01f1f53
Merge branch 'master' into chore/Django-4.1-upgrade
webjunkie Dec 6, 2023
6612568
Merge branch 'master' into chore/Django-4.1-upgrade
webjunkie Dec 7, 2023
bfeb531
Merge branch 'master' into chore/Django-4.1-upgrade
webjunkie Dec 7, 2023
ca287ca
Set CSRF_TRUSTED_ORIGINS
webjunkie Dec 7, 2023
380cc61
Update access.py
webjunkie Dec 8, 2023
5d142a9
Merge branch 'master' into chore/Django-4.1-upgrade
webjunkie Dec 8, 2023
8d2f660
Fix problems
webjunkie Dec 9, 2023
46d6948
Fix types
webjunkie Dec 11, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.11
'
SELECT (1) AS "a"
SELECT 1 AS "a"
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
Expand Down Expand Up @@ -159,7 +159,7 @@
---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.3
'
SELECT (1) AS "a"
SELECT 1 AS "a"
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
Expand Down
2 changes: 1 addition & 1 deletion posthog/api/test/__snapshots__/test_decide.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
---
# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.3
'
SELECT (1) AS "a"
SELECT 1 AS "a"
FROM "posthog_grouptypemapping"
WHERE "posthog_grouptypemapping"."team_id" = 2
LIMIT 1 /*controller='team-detail',route='api/projects/%28%3FP%3Cid%3E%5B%5E/.%5D%2B%29/%3F%24'*/
Expand Down
62 changes: 31 additions & 31 deletions posthog/api/test/__snapshots__/test_feature_flag.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@
WHERE ("posthog_persondistinctid"."id" IN
(SELECT U0."id"
FROM "posthog_persondistinctid" U0
WHERE U0."person_id" = "posthog_persondistinctid"."person_id"
WHERE U0."person_id" = ("posthog_persondistinctid"."person_id")
LIMIT 3)
AND "posthog_persondistinctid"."person_id" IN (1,
2,
Expand All @@ -620,10 +620,10 @@
AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid,
'00000000-0000-0000-0000-000000000001'::uuid /* ... */)
AND NOT (EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U1
WHERE (U1."cohort_id" = 2
AND U1."person_id" = "posthog_person"."id")
AND U1."person_id" = ("posthog_person"."id"))
LIMIT 1)))
'
---
Expand Down Expand Up @@ -693,10 +693,10 @@
AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid,
'00000000-0000-0000-0000-000000000001'::uuid /* ... */)
AND NOT (EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U1
WHERE (U1."cohort_id" = 2
AND U1."person_id" = "posthog_person"."id")
AND U1."person_id" = ("posthog_person"."id"))
LIMIT 1)))
'
---
Expand Down Expand Up @@ -730,7 +730,7 @@
WHERE ("posthog_persondistinctid"."id" IN
(SELECT U0."id"
FROM "posthog_persondistinctid" U0
WHERE U0."person_id" = "posthog_persondistinctid"."person_id"
WHERE U0."person_id" = ("posthog_persondistinctid"."person_id")
LIMIT 3)
AND "posthog_persondistinctid"."person_id" IN (1,
2,
Expand All @@ -747,10 +747,10 @@
AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid,
'00000000-0000-0000-0000-000000000001'::uuid /* ... */)
AND NOT (EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U1
WHERE (U1."cohort_id" = 2
AND U1."person_id" = "posthog_person"."id")
AND U1."person_id" = ("posthog_person"."id"))
LIMIT 1)))
'
---
Expand Down Expand Up @@ -808,10 +808,10 @@
AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid,
'00000000-0000-0000-0000-000000000001'::uuid /* ... */)
AND NOT (EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U1
WHERE (U1."cohort_id" = 2
AND U1."person_id" = "posthog_person"."id")
AND U1."person_id" = ("posthog_person"."id"))
LIMIT 1)))
'
---
Expand Down Expand Up @@ -925,7 +925,7 @@
WHERE ("posthog_persondistinctid"."id" IN
(SELECT U0."id"
FROM "posthog_persondistinctid" U0
WHERE U0."person_id" = "posthog_persondistinctid"."person_id"
WHERE U0."person_id" = ("posthog_persondistinctid"."person_id")
LIMIT 3)
AND "posthog_persondistinctid"."person_id" IN (1,
2,
Expand All @@ -939,11 +939,11 @@
SELECT ("posthog_person"."id" IS NULL
OR "posthog_person"."id" IS NULL
OR EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U0
WHERE (U0."cohort_id" = 2
AND U0."cohort_id" = 2
AND U0."person_id" = "posthog_person"."id")
AND U0."person_id" = ("posthog_person"."id"))
LIMIT 1)
OR "posthog_person"."id" IS NULL) AS "flag_X_condition_0"
FROM "posthog_person"
Expand All @@ -958,11 +958,11 @@
SELECT ("posthog_person"."id" IS NOT NULL
OR "posthog_person"."id" IS NULL
OR EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U0
WHERE (U0."cohort_id" = 2
AND U0."cohort_id" = 2
AND U0."person_id" = "posthog_person"."id")
AND U0."person_id" = ("posthog_person"."id"))
LIMIT 1)
OR "posthog_person"."id" IS NULL) AS "flag_X_condition_0"
FROM "posthog_person"
Expand All @@ -977,11 +977,11 @@
SELECT ("posthog_person"."id" IS NULL
OR "posthog_person"."id" IS NOT NULL
OR EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U0
WHERE (U0."cohort_id" = 2
AND U0."cohort_id" = 2
AND U0."person_id" = "posthog_person"."id")
AND U0."person_id" = ("posthog_person"."id"))
LIMIT 1)
OR "posthog_person"."id" IS NULL) AS "flag_X_condition_0"
FROM "posthog_person"
Expand All @@ -996,11 +996,11 @@
SELECT ("posthog_person"."id" IS NULL
OR "posthog_person"."id" IS NULL
OR EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U0
WHERE (U0."cohort_id" = 2
AND U0."cohort_id" = 2
AND U0."person_id" = "posthog_person"."id")
AND U0."person_id" = ("posthog_person"."id"))
LIMIT 1)
OR "posthog_person"."id" IS NULL) AS "flag_X_condition_0"
FROM "posthog_person"
Expand Down Expand Up @@ -1086,7 +1086,7 @@
WHERE ("posthog_persondistinctid"."id" IN
(SELECT U0."id"
FROM "posthog_persondistinctid" U0
WHERE U0."person_id" = "posthog_persondistinctid"."person_id"
WHERE U0."person_id" = ("posthog_persondistinctid"."person_id")
LIMIT 3)
AND "posthog_persondistinctid"."person_id" IN (1,
2,
Expand Down Expand Up @@ -1132,10 +1132,10 @@
AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid,
'00000000-0000-0000-0000-000000000001'::uuid /* ... */)
AND NOT (EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U1
WHERE (U1."cohort_id" = 2
AND U1."person_id" = "posthog_person"."id")
AND U1."person_id" = ("posthog_person"."id"))
LIMIT 1)))
'
---
Expand Down Expand Up @@ -1226,7 +1226,7 @@
WHERE ("posthog_persondistinctid"."id" IN
(SELECT U0."id"
FROM "posthog_persondistinctid" U0
WHERE U0."person_id" = "posthog_persondistinctid"."person_id"
WHERE U0."person_id" = ("posthog_persondistinctid"."person_id")
LIMIT 3)
AND "posthog_persondistinctid"."person_id" IN (1,
2,
Expand Down Expand Up @@ -1262,10 +1262,10 @@
AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid,
'00000000-0000-0000-0000-000000000001'::uuid /* ... */)
AND NOT (EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U1
WHERE (U1."cohort_id" = 2
AND U1."person_id" = "posthog_person"."id")
AND U1."person_id" = ("posthog_person"."id"))
LIMIT 1)))
'
---
Expand Down Expand Up @@ -1656,7 +1656,7 @@
WHERE ("posthog_persondistinctid"."id" IN
(SELECT U0."id"
FROM "posthog_persondistinctid" U0
WHERE U0."person_id" = "posthog_persondistinctid"."person_id"
WHERE U0."person_id" = ("posthog_persondistinctid"."person_id")
LIMIT 3)
AND "posthog_persondistinctid"."person_id" IN (1,
2,
Expand Down Expand Up @@ -1734,10 +1734,10 @@
AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid,
'00000000-0000-0000-0000-000000000001'::uuid /* ... */)
AND NOT (EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U1
WHERE (U1."cohort_id" = 2
AND U1."person_id" = "posthog_person"."id")
AND U1."person_id" = ("posthog_person"."id"))
LIMIT 1)))
'
---
Expand Down Expand Up @@ -2045,7 +2045,7 @@
WHERE ("posthog_persondistinctid"."id" IN
(SELECT U0."id"
FROM "posthog_persondistinctid" U0
WHERE U0."person_id" = "posthog_persondistinctid"."person_id"
WHERE U0."person_id" = ("posthog_persondistinctid"."person_id")
LIMIT 3)
AND "posthog_persondistinctid"."person_id" IN (1,
2,
Expand Down Expand Up @@ -2081,10 +2081,10 @@
AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid,
'00000000-0000-0000-0000-000000000001'::uuid /* ... */)
AND NOT (EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U1
WHERE (U1."cohort_id" = 2
AND U1."person_id" = "posthog_person"."id")
AND U1."person_id" = ("posthog_person"."id"))
LIMIT 1))) /*controller='project_feature_flags-create-static-cohort-for-flag',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/feature_flags/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/create_static_cohort_for_flag/%3F%24'*/
'
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@
---
# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.2
'
SELECT (1) AS "a"
SELECT 1 AS "a"
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
Expand Down Expand Up @@ -1538,7 +1538,7 @@
---
# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.8
'
SELECT (1) AS "a"
SELECT 1 AS "a"
FROM "posthog_featureflag"
WHERE (NOT "posthog_featureflag"."deleted"
AND "posthog_featureflag"."key" = 'copied-flag-key'
Expand Down Expand Up @@ -1624,7 +1624,7 @@
---
# name: TestOrganizationFeatureFlagGet.test_get_feature_flag_success.2
'
SELECT (1) AS "a"
SELECT 1 AS "a"
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
Expand Down
8 changes: 4 additions & 4 deletions posthog/api/test/__snapshots__/test_plugin.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
---
# name: TestPluginAPI.test_listing_plugins_is_not_nplus1.15
'
SELECT (1) AS "a"
SELECT 1 AS "a"
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
Expand Down Expand Up @@ -378,7 +378,7 @@
---
# name: TestPluginAPI.test_listing_plugins_is_not_nplus1.21
'
SELECT (1) AS "a"
SELECT 1 AS "a"
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
Expand Down Expand Up @@ -456,7 +456,7 @@
---
# name: TestPluginAPI.test_listing_plugins_is_not_nplus1.3
'
SELECT (1) AS "a"
SELECT 1 AS "a"
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
Expand Down Expand Up @@ -566,7 +566,7 @@
---
# name: TestPluginAPI.test_listing_plugins_is_not_nplus1.9
'
SELECT (1) AS "a"
SELECT 1 AS "a"
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
Expand Down
9 changes: 9 additions & 0 deletions posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,9 @@
OR "posthog_dashboardtile"."insight_id" IS NULL)
AND "posthog_dashboardtile"."dashboard_id" = 2
AND "posthog_dashboardtile"."dashboard_id" = 2
AND NOT ("posthog_dashboard"."deleted"
AND "posthog_dashboardtile"."deleted"
AND "posthog_dashboardtile"."deleted" IS NOT NULL)
Comment on lines +964 to +966
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting change... I guess it's only enforcing that we don't return deleted things so probably fine

AND (NOT "posthog_dashboarditem"."deleted"
OR "posthog_dashboardtile"."insight_id" IS NULL))
ORDER BY "posthog_dashboarditem"."order" ASC /*controller='project_dashboards-detail',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/%3F%24'*/
Expand Down Expand Up @@ -7326,6 +7329,9 @@
OR "posthog_dashboardtile"."insight_id" IS NULL)
AND "posthog_dashboardtile"."dashboard_id" = 2
AND "posthog_dashboardtile"."dashboard_id" = 2
AND NOT ("posthog_dashboard"."deleted"
AND "posthog_dashboardtile"."deleted"
AND "posthog_dashboardtile"."deleted" IS NOT NULL)
AND (NOT "posthog_dashboarditem"."deleted"
OR "posthog_dashboardtile"."insight_id" IS NULL))
ORDER BY "posthog_dashboarditem"."order" ASC /*controller='project_dashboards-detail',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/%3F%24'*/
Expand Down Expand Up @@ -9990,6 +9996,9 @@
OR "posthog_dashboardtile"."insight_id" IS NULL)
AND "posthog_dashboardtile"."dashboard_id" = 2
AND "posthog_dashboardtile"."dashboard_id" = 2
AND NOT ("posthog_dashboard"."deleted"
AND "posthog_dashboardtile"."deleted"
AND "posthog_dashboardtile"."deleted" IS NOT NULL)
AND (NOT "posthog_dashboarditem"."deleted"
OR "posthog_dashboardtile"."insight_id" IS NULL))
ORDER BY "posthog_dashboarditem"."order" ASC /*controller='project_dashboards-detail',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/%3F%24'*/
Expand Down
2 changes: 1 addition & 1 deletion posthog/api/test/test_organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@ async def acreate_organization(name: str) -> Organization:
could use either the api, or django admin to create, to get better parity
with real world scenarios.
"""
return await sync_to_async(create_organization)(name) # type: ignore
return await sync_to_async(create_organization)(name)
2 changes: 1 addition & 1 deletion posthog/api/test/test_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,4 +736,4 @@ async def acreate_team(organization: Organization, name: str = "Test team") -> T
could use either the api, or django admin to create, to get better parity
with real world scenarios.
"""
return await sync_to_async(create_team)(organization, name=name) # type: ignore
return await sync_to_async(create_team)(organization, name=name)
2 changes: 1 addition & 1 deletion posthog/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def __init__(self, get_response):
# Some middlewares raise MiddlewareNotUsed if they are not
# needed. In this case we want to avoid the default middlewares
# being used.
middlewares.append(middleware_class(get_response=None))
middlewares.append(middleware_class(get_response=get_response))
except MiddlewareNotUsed:
pass

Expand Down
4 changes: 2 additions & 2 deletions posthog/models/filters/test/__snapshots__/test_filter.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@
---
# name: TestDjangoPropertiesToQ.test_person_relative_date_parsing_with_invalid_date
'
SELECT (1) AS "a"
SELECT 1 AS "a"
FROM "posthog_person"
INNER JOIN "posthog_persondistinctid" ON ("posthog_person"."id" = "posthog_persondistinctid"."person_id")
WHERE ("posthog_persondistinctid"."distinct_id" = 'example_id'
Expand All @@ -359,7 +359,7 @@
---
# name: TestDjangoPropertiesToQ.test_person_relative_date_parsing_with_invalid_date.1
'
SELECT (1) AS "a"
SELECT 1 AS "a"
FROM "posthog_person"
INNER JOIN "posthog_persondistinctid" ON ("posthog_person"."id" = "posthog_persondistinctid"."person_id")
WHERE ("posthog_persondistinctid"."distinct_id" = 'example_id'
Expand Down
Loading
Loading