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

Class FeatureSegment

api/features/models.py:248–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246
247
248class FeatureSegment(
249 LifecycleModelMixin, # type: ignore[misc]
250 AbstractBaseExportableModel,
251 OrderedModelBase, # type: ignore[misc]
252 abstract_base_auditable_model_factory(["uuid"]), # type: ignore[misc]
253):
254 history_record_class_path = "features.models.HistoricalFeatureSegment"
255 related_object_type = RelatedObjectType.FEATURE
256
257 feature = models.ForeignKey(
258 Feature, on_delete=models.CASCADE, related_name="feature_segments"
259 )
260 segment = models.ForeignKey(
261 "segments.Segment", related_name="feature_segments", on_delete=models.CASCADE
262 )
263 environment = models.ForeignKey(
264 "environments.Environment",
265 on_delete=models.CASCADE,
266 related_name="feature_segments",
267 )
268 environment_feature_version = models.ForeignKey(
269 "feature_versioning.EnvironmentFeatureVersion",
270 on_delete=models.CASCADE,
271 related_name="feature_segments",
272 null=True,
273 blank=True,
274 )
275
276 _enabled = models.BooleanField(
277 default=False,
278 db_column="enabled",
279 help_text="Deprecated in favour of using FeatureStateValue.",
280 )
281 _value = models.CharField(
282 max_length=2000,
283 blank=True,
284 null=True,
285 db_column="value",
286 help_text="Deprecated in favour of using FeatureStateValue.",
287 )
288 _value_type = models.CharField(
289 choices=FEATURE_STATE_VALUE_TYPES,
290 max_length=50,
291 blank=True,
292 null=True,
293 db_column="value_type",
294 help_text="Deprecated in favour of using FeatureStateValue.",
295 )
296
297 # specific attributes for managing the order of feature segments
298 priority = models.PositiveIntegerField(editable=False, db_index=True)
299 order_field_name = "priority"
300 order_with_respect_to = ("feature", "environment", "environment_feature_version")
301
302 objects = FeatureSegmentManager() # type: ignore[misc]
303
304 class Meta:
305 unique_together = (

Callers

nothing calls this directly

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…