Skip to content

Commit

Permalink
fix(django-upgrade): upgrade django major version (#4136)
Browse files Browse the repository at this point in the history
  • Loading branch information
gagantrivedi authored Aug 28, 2024
1 parent 0be9a1e commit aa234e4
Show file tree
Hide file tree
Showing 47 changed files with 563 additions and 172 deletions.
6 changes: 5 additions & 1 deletion api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,13 @@ generate-ld-client-types:
.PHONY: integrate-private-tests
integrate-private-tests:
$(eval WORKFLOW_REVISION := $(shell grep -A 1 "\[tool.poetry.group.workflows.dependencies\]" pyproject.toml | awk -F '"' '{printf $$4}'))
$(eval TASK_PROCESSOR_REVISION := $(shell grep -A 0 "flagsmith-task-processor" pyproject.toml | awk -F '"' '{printf $$4}'))
$(eval AUTH_CONTROLLER_REVISION := $(shell grep -A 1 "\[tool.poetry.group.auth-controller.dependencies\]" pyproject.toml | awk -F '"' '{printf $$4}'))

git clone https://github.com/flagsmith/flagsmith-saml --depth 1 --branch ${SAML_REVISION} && mv ./flagsmith-saml/tests tests/saml_tests
git clone https://github.com/flagsmith/flagsmith-rbac --depth 1 --branch ${RBAC_REVISION} && mv ./flagsmith-rbac/tests tests/rbac_tests
git clone https://github.com/flagsmith/flagsmith-workflows --depth 1 --branch ${WORKFLOW_REVISION} && mv ./flagsmith-workflows/tests tests/workflow_tests
git clone https://github.com/flagsmith/flagsmith-auth-controller --depth 1 --branch ${AUTH_CONTROLLER_REVISION} && mv ./flagsmith-auth-controller/tests tests/auth_controller_tests
rm -rf ./flagsmith-saml ./flagsmith-rbac ./flagsmith-workflows ./flagsmith-auth-controller

git clone https://github.com/flagsmith/flagsmith-task-processor --depth 1 --branch ${TASK_PROCESSOR_REVISION} && mv ./flagsmith-task-processor/tests tests/task_processor_tests
rm -rf ./flagsmith-saml ./flagsmith-rbac ./flagsmith-workflows ./flagsmith-auth-controller ./flagsmith-task-processor
1 change: 0 additions & 1 deletion api/audit/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "audit.apps.AuditConfig"
1 change: 0 additions & 1 deletion api/core/custom_admin/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "core.custom_admin.apps.CustomAdminAppConfig"
1 change: 0 additions & 1 deletion api/environments/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "environments.apps.EnvironmentsConfig"
1 change: 1 addition & 0 deletions api/environments/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

class EnvironmentsConfig(BaseAppConfig):
name = "environments"
default = True
1 change: 0 additions & 1 deletion api/environments/identities/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "environments.identities.apps.IdentitiesConfig"
4 changes: 3 additions & 1 deletion api/environments/identities/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ def get_segments(
:return: List of matching segments
"""
matching_segments = []
traits = self.identity_traits.all() if traits is None else traits
traits = (
self.identity_traits.all() if (traits is None and self.id) else traits or []
)

if overrides_only:
all_segments = self.environment.get_segments_from_cache()
Expand Down
2 changes: 1 addition & 1 deletion api/environments/identities/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def _get_all_feature_states_for_user_response(
{
"flags": all_feature_states,
"identifier": identity.identifier,
"traits": identity.identity_traits.all(),
"traits": identity.identity_traits.all() if identity.id else [],
},
context=self.get_serializer_context(),
)
Expand Down
1 change: 0 additions & 1 deletion api/environments/permissions/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "environments.permissions.apps.EnvironmentPermissionsConfig"
1 change: 0 additions & 1 deletion api/features/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "features.apps.FeaturesConfig"
1 change: 1 addition & 0 deletions api/features/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

class FeaturesConfig(BaseAppConfig):
name = "features"
default = True

def ready(self):
super().ready()
Expand Down
3 changes: 0 additions & 3 deletions api/features/feature_external_resources/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
default_app_config = (
"features.feature_external_resources.apps.FeatureExternalResourcesConfig"
)
6 changes: 0 additions & 6 deletions api/features/feature_segments/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
name="list",
decorator=swagger_auto_schema(query_serializer=FeatureSegmentQuerySerializer()),
)
@method_decorator(
name="update_priorities",
decorator=swagger_auto_schema(
responses={200: FeatureSegmentListSerializer(many=True)}
),
)
class FeatureSegmentViewSet(
viewsets.ModelViewSet,
):
Expand Down
1 change: 0 additions & 1 deletion api/features/multivariate/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "features.multivariate.apps.MultivariateConfig"
1 change: 1 addition & 0 deletions api/features/multivariate/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

class MultivariateConfig(BaseAppConfig):
name = "features.multivariate"
default = True
1 change: 0 additions & 1 deletion api/features/versioning/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "features.versioning.apps.FeatureVersioningAppConfig"
1 change: 0 additions & 1 deletion api/features/workflows/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "features.workflows.core.app.WorkflowsCoreAppConfig"
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
class WorkflowsCoreAppConfig(BaseAppConfig):
name = "features.workflows.core"
label = "workflows_core"
default = True
1 change: 0 additions & 1 deletion api/integrations/amplitude/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "integrations.amplitude.apps.AmplitudeIntegrationConfig"
1 change: 0 additions & 1 deletion api/integrations/datadog/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "integrations.datadog.apps.DataDogConfigurationConfig"
1 change: 0 additions & 1 deletion api/integrations/dynatrace/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "integrations.dynatrace.apps.DynatraceConfigurationConfig"
1 change: 0 additions & 1 deletion api/integrations/github/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "integrations.github.apps.GithubIntegrationConfig"
1 change: 0 additions & 1 deletion api/integrations/grafana/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "integrations.grafana.apps.GrafanaConfigurationConfig"
1 change: 0 additions & 1 deletion api/integrations/heap/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "integrations.heap.apps.HeapIntegrationConfig"
1 change: 1 addition & 0 deletions api/integrations/launch_darkly/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

class LaunchDarklyConfigurationConfig(BaseAppConfig):
name = "integrations.launch_darkly"
default = True
6 changes: 4 additions & 2 deletions api/integrations/launch_darkly/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class LaunchDarklyImportStatus(TypedDict):
class LaunchDarklyImportRequest(
abstract_base_auditable_model_factory(),
):
history_record_class_path = "features.models.HistoricalLaunchDarklyImportRequest"
history_record_class_path = (
"integrations.launch_darkly.models.HistoricalLaunchDarklyImportRequest"
)
related_object_type = RelatedObjectType.IMPORT_REQUEST

created_by = models.ForeignKey("users.FFAdminUser", on_delete=models.CASCADE)
Expand Down Expand Up @@ -51,7 +53,7 @@ def get_update_log_message(self, _) -> Optional[str]:
)
return "LaunchDarkly import failed"

def get_audit_log_author(self) -> "FFAdminUser":
def get_audit_log_author(self, history_instance) -> "FFAdminUser":
return self.created_by

def _get_project(self) -> Project:
Expand Down
1 change: 0 additions & 1 deletion api/integrations/mixpanel/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "integrations.mixpanel.apps.MixpanelIntegrationConfig"
1 change: 0 additions & 1 deletion api/integrations/new_relic/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "integrations.new_relic.apps.NewRelicConfigurationConfig"
1 change: 0 additions & 1 deletion api/integrations/rudderstack/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "integrations.rudderstack.apps.RudderstackIntegrationConfig"
1 change: 0 additions & 1 deletion api/integrations/segment/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "integrations.segment.apps.SegmentIntegrationConfig"
1 change: 0 additions & 1 deletion api/integrations/sentry/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "integrations.sentry.apps.SentryConfig"
1 change: 0 additions & 1 deletion api/integrations/webhook/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "integrations.webhook.apps.WebhookIntegrationConfig"
1 change: 0 additions & 1 deletion api/organisations/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "organisations.apps.OrganisationsConfig"
1 change: 0 additions & 1 deletion api/organisations/invites/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "organisations.invites.apps.InvitesConfig"
1 change: 0 additions & 1 deletion api/organisations/permissions/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "organisations.permissions.apps.OrganisationPermissionsConfig"
Loading

0 comments on commit aa234e4

Please sign in to comment.