MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / Environment

Class Environment

api/environments/models.py:80–620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78
79
80class Environment(
81 LifecycleModel, # type: ignore[misc]
82 abstract_base_auditable_model_factory( # type: ignore[misc]
83 change_details_excluded_fields=["updated_at"],
84 historical_records_excluded_fields=["uuid"],
85 ),
86 SoftDeleteObject, # type: ignore[misc]
87):
88 history_record_class_path = "environments.models.HistoricalEnvironment"
89 related_object_type = RelatedObjectType.ENVIRONMENT
90
91 name = models.CharField(max_length=2000) # type: ignore[var-annotated]
92 uuid = models.UUIDField(default=uuid.uuid4, unique=True, editable=False) # type: ignore[var-annotated]
93 created_date = models.DateTimeField("DateCreated", auto_now_add=True) # type: ignore[var-annotated]
94 description = models.TextField(null=True, blank=True, max_length=20000) # type: ignore[var-annotated]
95 project = models.ForeignKey( # type: ignore[var-annotated]
96 "projects.Project",
97 related_name="environments",
98 help_text=(
99 "Changing the project selected will remove all previous Feature States for"
100 " the previously associated projects Features that are related to this"
101 " Environment. New default Feature States will be created for the new"
102 " selected projects Features for this Environment."
103 ),
104 # Cascade deletes are decouple from the Django ORM. See this PR for details.
105 # https://github.com/Flagsmith/flagsmith/pull/3360/
106 on_delete=models.DO_NOTHING,
107 )
108
109 api_key = models.CharField( # type: ignore[var-annotated]
110 default=generate_client_api_key, unique=True, max_length=100
111 )
112
113 minimum_change_request_approvals = models.IntegerField(blank=True, null=True) # type: ignore[var-annotated]
114
115 webhooks_enabled = models.BooleanField(default=False, help_text="DEPRECATED FIELD.") # type: ignore[var-annotated] # noqa: E501
116 webhook_url = models.URLField(null=True, blank=True, help_text="DEPRECATED FIELD.") # type: ignore[var-annotated]
117
118 allow_client_traits = models.BooleanField( # type: ignore[var-annotated]
119 default=True, help_text="Allows clients using the client API key to set traits."
120 )
121 updated_at = models.DateTimeField( # type: ignore[var-annotated]
122 default=timezone.now,
123 help_text="Tracks changes to self and related entities, e.g. FeatureStates.",
124 )
125 banner_text = models.CharField(null=True, blank=True, max_length=255) # type: ignore[var-annotated]
126 banner_colour = models.CharField( # type: ignore[var-annotated]
127 null=True, blank=True, max_length=7, help_text="hex code for the banner colour"
128 )
129 metadata = GenericRelation(Metadata)
130
131 hide_disabled_flags = models.BooleanField( # type: ignore[var-annotated]
132 null=True,
133 blank=True,
134 help_text=(
135 "If true will exclude flags from SDK which are disabled. NOTE: If set, this"
136 " will override the project `hide_disabled_flags`"
137 ),

Used in the wild real call sites across dependent graphs

searching dependent graphs…